Avoid hardcoding configuration values directly in scripts, especially for values that might change between environments or contain sensitive information. Instead, use environment variables, build parameters, or secrets management systems.
Avoid hardcoding configuration values directly in scripts, especially for values that might change between environments or contain sensitive information. Instead, use environment variables, build parameters, or secrets management systems.
Key practices:
Example - Instead of:
export CHEF_LICENSE_SERVER="http://hosted-license-service-lb-8000-606952349.us-west-2.elb.amazonaws.com:8000"
Use:
export CHEF_LICENSE_SERVER="${CHEF_LICENSE_SERVER:-fallback_value_for_dev_only}"
Or configure the value in your CI/CD system’s environment variables or secrets store.
For version information, prefer environment variables provided by your CI/CD system over reading from files:
# Preferred
VERSION="${EXPEDITOR_VERSION}"
# Avoid
VERSION=$(cat VERSION)
Enter the URL of a public GitHub repository