Skip to main content

Environment Variables

Configure environment variables for template access and build customization

Config-defined variables

Define custom environment variables in your config's top-level env field:

env:
  MY_VAR: "some_value"
  BUILD_TYPE: "release"

These are available in templates as {{ Env.MY_VAR }} and are set in the environment for all external commands (cargo, docker, nfpm, etc.).

Per-target build environment

Set environment variables for specific build targets:

crates:
  - name: myapp
    builds:
      - binary: myapp
        env:
          x86_64-unknown-linux-gnu:
            CC: "gcc"
            OPENSSL_DIR: "/usr/local/ssl"
          aarch64-unknown-linux-gnu:
            CC: "aarch64-linux-gnu-gcc"

Standard environment variables

Anodizer respects these environment variables:

VariableDescription
ANODIZER_GITHUB_TOKENGitHub API token (takes precedence over GITHUB_TOKEN)
GITHUB_TOKENGitHub API token for releases and publishing
CARGO_REGISTRY_TOKENToken for crates.io publishing
DOCKER_USERNAME / DOCKER_PASSWORDDocker registry credentials

GitHub release upload tuning

VariableTypeDefaultDescription
ANODIZER_GITHUB_UPLOAD_CONCURRENCYu324Cap on parallel asset uploads to a GitHub release. Override of release.upload_concurrency:. Keep low (≤8) to avoid GitHub's secondary rate limit when releases include many artifacts.
ANODIZER_GITHUB_SECONDARY_RL_DELAY_SECSinteger seconds60Sleep duration after a GitHub secondary rate-limit response (403/429 carrying the "secondary rate limit" marker in the body or secondary-rate-limits in the documentation_url). Applied with ±20% jitter before the next upload retry.

Template access

All environment variables (both config-defined and inherited from the shell) are accessible in templates:

name_template: "{{ ProjectName }}-{{ Env.BUILD_NUMBER }}"