Initialization
Create a client with basic configuration:Use environment variables for your API key to avoid committing secrets to version control.
Configuration Options
Option | Type | Default | Description |
---|---|---|---|
apiKey | string | – | Your Secton API key |
baseURL | string | 'https://api.secton.org/v1' | API base URL override |
timeout | number | 30000 | Request timeout in milliseconds |
retries | number | 3 | Number of retry attempts |
debug | boolean | false | Enable debug logging |
userAgent | string | 'secton-sdk/1.0.0' | Custom user agent string |
logLevel | object | { error: true, warn: true, info: false, debug: false } | Logging levels configuration |
Config Builder
Use the fluentconfigBuilder
for cleaner setup:
The fluent builder is especially useful when dynamically setting options from environment variables or user input.
Environment Variables
Configure the client via environment variables for flexibility across environments:Use in CI/CD Pipelines
Use in CI/CD Pipelines
You can set these environment variables in your CI/CD pipelines to avoid hardcoding secrets. Example for GitHub Actions:
Dynamic Configuration
Dynamic Configuration
Options can also be set programmatically at runtime based on environment or user input: