Configuration Guide
Learn how to configure the SDK for your specific needs.
Basic Configuration
Initialize the client with your API key:
javascript
import { Client } from '@your-sdk/core';
const client = new Client({
apiKey: process.env.API_KEY
});
Environment Variables
Store sensitive information in environment variables:
bash
# .env
API_KEY=your_api_key_here
ENVIRONMENT=production
javascript
const client = new Client({
apiKey: process.env.API_KEY,
environment: process.env.ENVIRONMENT
});
Advanced Configuration
Custom Base URL
javascript
const client = new Client({
apiKey: process.env.API_KEY,
baseURL: 'https://api.custom-domain.com'
});
Request Timeout
javascript
const client = new Client({
apiKey: process.env.API_KEY,
timeout: 30000 // 30 seconds
});
Retry Configuration
javascript
const client = new Client({
apiKey: process.env.API_KEY,
retry: {
maxAttempts: 3,
delay: 1000
}
});
TypeScript Configuration
For TypeScript projects, enable strict type checking:
json
{
"compilerOptions": {
"strict": true,
"esModuleInterop": true
}
}
Best Practices
- Never commit API keys to version control
- Use environment variables for configuration
- Enable logging in development
- Set appropriate timeouts for your use case
Is this page helpful?