Configuration
Relevant source files
The following files were used as context for generating this wiki page:The DevSkyy platform utilizes a unified, enterprise-grade configuration system designed for security, clarity, and maintainability. It provides a single source of truth for all application settings, leveraging Pydantic for validation and type safety. This system ensures that no secrets are hardcoded and that configuration loading follows a clear and predictable order of precedence.
The core design principles are immutability (configurations are frozen after creation), type safety, and self-documentation through descriptive fields. This approach is critical for production readiness and aligns with the project's "Truth Protocol," which mandates explicit, verifiable settings.
Sources: config/README.md, PRODUCTION_CHECKLIST.md:20-24
Configuration Loading and Precedence
The system loads settings from multiple sources in a specific order, with later sources overriding earlier ones. This provides flexibility for different environments (development, testing, production) while maintaining a clear hierarchy.
The following diagram illustrates the configuration loading flow.
This diagram shows the order of precedence for loading configuration values.
The precedence is as follows:
- Environment Variables: Highest priority. These are ideal for production and CI/CD environments.
- .env File: Values loaded from a
.envfile in the project root. Useful for local development. - Runtime Overrides: Programmatic overrides.
- Config Class Defaults: Lowest priority. These are the default values defined within the Pydantic configuration models.
Sources: config/README.md:14-20
Unified Configuration Structure
The configuration is managed through a central UnifiedConfig class which contains nested Pydantic models for different sections of the application. This modular structure organizes settings logically and provides type safety for each group of parameters.
Sources: PRODUCTION_CHECKLIST.md:21-23, config/README.md:58-64
The diagram below shows the class structure of the unified configuration system.
This class diagram illustrates the nested Pydantic models within the UnifiedConfig object.
Sources: config/README.md:58-131
Modern Python Configuration (pyproject.toml)
In addition to the application's runtime configuration, the project leverages pyproject.toml for modern Python project management, including tool configuration for quality assurance. This aligns with enterprise standards observed in repositories like SkyyRoseLLC/transformers.
[tool.ruff]
target-version = "py311"
line-length = 119
src = ["src"]
[tool.ruff.lint]
select = ["E", "F", "I", "W", "C", "UP", "RUF"]
ignore = ["E501"]
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
This snippet shows the recommended Ruff linter and formatter configuration for DevSkyy.
Sources: TRANSFORMERS_INTEGRATION_ANALYSIS.md:121-134
Environment Variables Quick Reference
All configuration can be controlled via environment variables. The system is designed to be "secure by default," requiring critical values like SECRET_KEY to be set explicitly in production environments.
Sources: config/README.md:133-137, ENV_SETUP_GUIDE.md:11-17
General
| Variable | Description | Default |
|---|---|---|
ENVIRONMENT | The runtime environment. | development |
LOG_LEVEL | The application log level. | INFO |
DEBUG | Enables or disables debug mode. | false |
Sources: DOCKER_MCP_DEPLOYMENT.md:188-192, config/README.md:89-91
Security Configuration
A strong SECRET_KEY is mandatory for production. It is used for signing JWTs and other cryptographic operations.
| Variable | Description | Default |
|---|---|---|
SECRET_KEY | Required in production. 32+ character key for JWTs. | Auto-generated in dev |
JWT_ALGORITHM | Algorithm for JWT signing. | HS256 |
ACCESS_TOKEN_EXPIRE_MINUTES | Expiry time for access tokens. | 30 |
PASSWORD_HASH_ALGORITHM | Hashing algorithm for passwords. | argon2id |
MIN_PASSWORD_LENGTH | Minimum required password length. | 12 |
Sources: config/README.md:76-87, UNICORN_QUICK_START_CHECKLIST.md:120-123
Database Configuration
The application supports multiple database backends, which can be configured with a single URL or individual parameters.
| Variable | Description | Default |
|---|---|---|
DATABASE_URL | Full connection string for the database. | sqlite:///./devskyy.db |
NEON_DATABASE_URL | Connection string for a Neon serverless DB. | None |
SUPABASE_DATABASE_URL | Connection string for a Supabase DB. | None |
DB_POOL_SIZE | Number of connections to keep in the pool. | 5 |
DB_MAX_OVERFLOW | Max overflow connections allowed. | 10 |
Sources: config/README.md:66-74, ENV_SETUP_GUIDE.md:32-55
AI Services Configuration
API keys for external AI services are managed via environment variables.
| Variable | Description | Source |
|---|---|---|
ANTHROPIC_API_KEY | API key for Anthropic (Claude) models. | console.anthropic.com |
OPENAI_API_KEY | API key for OpenAI (GPT) models. | platform.openai.com |
AI_DEFAULT_MODEL | The default model to use for requests. | claude-sonnet-4-5 |
AI_MAX_TOKENS | Default max tokens for model responses. | 4096 |
AI_TEMPERATURE | Default sampling temperature for models. | 0.7 |
Sources: config/README.md:125-131, ENV_SETUP_GUIDE.md:20-29, 60-67
Redis Configuration
| Variable | Description | Default |
|---|---|---|
REDIS_URL | Connection URL for the Redis server. | redis://localhost:6379 |
REDIS_MAX_CONNECTIONS | Max connections in the Redis pool. | 50 |
REDIS_DEFAULT_TTL | Default time-to-live for cached items (seconds). | 3600 |
Sources: config/README.md:103-107, UNICORN_QUICK_START_CHECKLIST.md:119
Production Validation
The system includes a validation function to ensure that all critical configurations are set correctly for a production environment. This check is a key part of the Production Readiness Checklist.
The validate_production_config() function checks for:
- A non-default, securely generated
SECRET_KEY. - A production-ready
DATABASE_URL(i.e., not SQLite). - The
ENVIRONMENTvariable is set toproduction.
This validation helps prevent common misconfigurations when deploying to production.
Sources: PRODUCTION_CHECKLIST.md:21-24, 29-30, config/README.md:43-51
Summary
The DevSkyy configuration system is a robust and secure foundation for the application. By centralizing settings, enforcing type safety with Pydantic, and prioritizing environment variables for sensitive data, it adheres to modern best practices. This unified approach simplifies management across different deployment environments, enhances security by eliminating hardcoded secrets, and improves overall maintainability, which is crucial for an enterprise-grade platform.
Sources: config/README.md:1-12, PRODUCTION_CHECKLIST.md:20-24