Home > Posts Prefixed env vars

Max Heinritz

Prefixed env vars

When creating custom environment variables, I find it’s best to prefix them in a way that indicates that they are made up. The company name can be used for this purpose. Or some other made up term like “INTERNAL_”:

INTERNAL_INITIAL_BOOTSTRAP_USER_PASSWORD
INTERNAL_LOCALHOST_SSL_CERT_PATH
INTERNAL_LOCALHOST_SSL_KEY_PATH

This helps avoid collisions with env vars expected by other libraries and tools such as Datadog:

DD_CONTAINER_INCLUDE
DD_CONTAINER_ENV_AS_TAGS

Or the AWS CLI:

AWS_ACCESS_KEY_ID
AWS_CA_BUNDLE

Notice that they follow a standard prefixing pattern of their own.