What Belongs in Configuration
You'll learn: What types of values should live in configuration files rather than hard-coded in your application source code.
The Core Principle
Not everything belongs in configuration, and not everything belongs in code. Configuration should contain values that change between environments or deployments without requiring code changes. Think of configuration as your application's "settings panel" — the knobs and switches that adjust behavior without rewriting the machine.
What Should Be Configurable?
Environment-Specific Values
Different environments (development, staging, production) have different settings. Database hostnames, API URLs, and log levels vary between these environments and belong in configuration.
Credentials and Secrets
API keys, database passwords, encryption keys, and authentication tokens must be configurable. Never hard-code these in source code where they'd be visible in version control.
Feature Flags
Toggles that enable or disable functionality should be configurable, allowing you to control features without redeploying code.
Resource Limits
Settings like connection pool sizes, timeout values, memory limits, and rate limits often need tuning per environment and should be configurable.
External Service Endpoints
URLs for third-party APIs, message queues, cache servers, and other external services change between environments and should be in configuration.
The Litmus Test
Ask yourself: "Will this value ever need to change based on where or when my application runs?" If yes, it belongs in configuration. If it's fundamental to how your code works (like algorithm logic), it belongs in code.
Key Takeaway: Configuration should contain environment-specific values, credentials, feature flags, resource limits, and service endpoints — anything that varies between deployments without requiring code changes.