Skip to main content

CodeNOW Context Variables

Every time an application component is deployed to a target environment, CodeNOW automatically injects a fixed set of CN_-prefixed environment variables into the running container. They expose the component's CodeNOW context — which account, application, component, version, environment, cluster and deployment it belongs to — so the running code can introspect where and as what it is deployed, without calling back to the platform.

These variables are platform-managed: you do not define them in the Deployment Configuration, and they are added on top of your own environment variables and any variables injected from connected services.

Scope

CodeNOW context variables are injected into application components only. They are not added to containers or managed services.

Available variables

The following variables make up the current (v1) set. Values shown are illustrative examples.

VariableMeaningExample
CN_ACCOUNT_IDIdentifier of the account the component belongs toacc-1
CN_ACCOUNT_NAMEAccount name — currently equal to the account id (see note below)acc-1
CN_APPLICATION_IDIdentifier of the applicationapp-1
CN_APPLICATION_NAMEHuman-readable application nameMy Application
CN_COMPONENT_IDIdentifier of the application componentcomp-1
CN_COMPONENT_NAMEHuman-readable component nameMy Component
CN_COMPONENT_VERSIONDeployed version of the component1.2.3
CN_PACKAGE_IDIdentifier of the resolved build/package deployedbuild-uuid
CN_PACKAGE_VERSIONVersion of the resolved package2.0.0
CN_IMAGE_TAGContainer image tag deployed1.2.3
CN_ENVIRONMENT_IDIdentifier of the target environmentprod-env
CN_ENVIRONMENT_NAMEHuman-readable environment nameProduction
CN_ENVIRONMENT_TYPEEnvironment classification — prod or nonprod onlyprod
CN_CLUSTER_IDIdentifier of the cluster the component runs oncluster-1
CN_CLUSTER_NAMEHuman-readable cluster nameEU Cluster
CN_NAMESPACEKubernetes namespace — equal to the environment idprod-env
CN_DEPLOYMENT_IDIdentifier of this deploymentdep-uuid
CN_DEPLOYED_ATDeployment timestamp, ISO-8601 in UTC2026-07-19T10:15:30Z

As-built behavior

A few values behave differently from what their name might suggest:

  • CN_ENVIRONMENT_TYPE is prod or nonprod only. It is derived from whether the target environment is the application's designated production environment. There is no stage / dev / test distinction in this version.
  • CN_PACKAGE_ID and CN_PACKAGE_VERSION are always present. Every deployment resolves a build/package, so these are emitted for every component.
  • CN_ACCOUNT_NAME currently equals the account id. No separate account display name exists yet, so the id is used as a fallback.
  • CN_NAMESPACE equals the environment id.

Overriding and naming collisions

The CN_ block is applied after your own environment variables. As a result:

warning

If you define your own environment variable using the CN_ prefix, the platform-injected value takes precedence and overwrites yours. In this version the CN_ prefix is not reserved or blocked — but to avoid surprises, do not use the CN_ prefix for your own variables. Reserving and enforcing the prefix is planned for a future iteration.

Not included in this version

The following are intentionally out of scope for the current version and are not emitted:

  • CN_DEPLOYED_BY — no manual-vs-automated deployment actor signal exists yet.
  • CN_IMAGE_DIGEST — only the image tag is available at deploy time.

Provenance metadata, platform URLs, pod-level details and OpenTelemetry-oriented variables are tracked as future work.