1.6 KiB
1.6 KiB
Kaigen Service Configuration
The Kaigen service is used for managing user credits during backtest operations. It requires proper configuration to function correctly.
Environment Variables
Required Environment Variable
KAIGEN_PRIVATE_KEY: The private key used for signing API requests to the Kaigen service.
Setting the Environment Variable
Development
export KAIGEN_PRIVATE_KEY="your-private-key-here"
Production
Set the environment variable in your deployment configuration:
KAIGEN_PRIVATE_KEY=your-private-key-here
Docker
docker run -e KAIGEN_PRIVATE_KEY=your-private-key-here your-app
Docker Compose
environment:
- KAIGEN_PRIVATE_KEY=your-private-key-here
Configuration Structure
The Kaigen service configuration is defined in appsettings.json:
{
"Kaigen": {
"BaseUrl": "https://api.kaigen.managing.live",
"DebitEndpoint": "/api/credits/debit",
"RefundEndpoint": "/api/credits/refund",
"PrivateKey": "${KAIGEN_PRIVATE_KEY}"
}
}
API Endpoints
- PUT
/api/credits/debit- Debit credits from user account - PUT
/api/credits/refund- Refund credits to user account
Security Notes
- The private key should never be committed to source control
- Use environment variables or secure configuration management systems
- The private key is used for signing API requests to ensure authenticity
- Rotate the private key regularly for enhanced security
Error Handling
If the KAIGEN_PRIVATE_KEY environment variable is not set, the application will throw an InvalidOperationException with a clear error message during startup.