Repository navigation
|
Question: What is the best architecture for managing configuration and logging in Stellar DevKit across local development, testnet and mainnet? In particular:
What approach would make the SDK secure, predictable and easy to configure? |
Replies: 1 comment
|
I would recommend a centralized configuration module combined with structured, security-conscious logging. 1. Configuration management Support environment variables and optional configuration files, with clearly documented precedence rules. Provide sensible defaults for non-sensitive settings. 2. Network profiles Create explicit profiles for local development, testnet and mainnet. Each profile should define the RPC endpoint, network passphrase and relevant environment settings. 3. Secret management Never hardcode private keys, API tokens or credentials. Read sensitive values from secure environment configuration or an appropriate secret-management system. 4. Structured logging Use structured logs with consistent fields such as timestamp, log level, operation, network and request identifier. Support DEBUG, INFO, WARN and ERROR levels. 5. Redaction Implement centralized redaction for credentials, authorization headers, private keys and sensitive request fields. Ensure error messages and debug logs cannot accidentally expose secrets. 6. Testing Test configuration precedence, invalid settings, missing credentials, log formatting and secret redaction. My recommendation is to keep configuration and logging independent of the RPC and contract modules. This makes both easier to test and maintain. |
I would recommend a centralized configuration module combined with structured, security-conscious logging.
1. Configuration management
Support environment variables and optional configuration files, with clearly documented precedence rules. Provide sensible defaults for non-sensitive settings.
2. Network profiles
Create explicit profiles for local development, testnet and mainnet. Each profile should define the RPC endpoint, network passphrase and relevant environment settings.
3. Secret management
Never hardcode private keys, API tokens or credentials. Read sensitive values from secure environment configuration or an appropriate secret-management system.
4. Structured logging
Use structu…