Infra credentials
Infrastructure credentials (Cloudflare, DigitalOcean, AWS, Hetzner) are
deliberately not part of a project’s docker/.config/ env layers. They are set
up once per workstation and resolved hierarchically, so a laptop with six mx
projects has one place its Cloudflare token lives.
mx infra setup cloudflare # global credentials, once per workstationmx infra list # what is configuredmx infra inspect cloudflare # where the values resolve from
cd myprojectmx infra link cloudflare # use the global credentials heremx infra unlink cloudflare # go back to project-localmx infra remove cloudflare # drop a provider's configurationmx infra list reports every known provider and whether it is configured:
Infrastructure Providers──────────────────────────────────────── • cloudflare - not configured • digitalocean - not configured • aws - not configured • hetzner - not configuredResolution order
Section titled “Resolution order”- Project-local:
./infra/<provider>/.env.<provider>, used when it exists and the project is not linked to global. - Global:
~/.mech-crate/config/infra/<provider>.env, used otherwise.
Linking is the normal case; project-local config is the escape hatch for a project that needs a different account than the rest of the workstation.
Credential files are gitignored. Nothing in this flow puts a token in a committed file, and nothing sends one anywhere except the provider.
Cloudflare, specifically
Section titled “Cloudflare, specifically”The Cloudflare deploy toolchain (make/cloudflare.mk and the cf-* scripts)
reads both scopes on every invocation, with no linking required:
- the environment, or the
makecommand line - project
infra/cloudflare/.env.cloudflare - global
~/.mech-crate/config/infra/cloudflare.env
One mx infra setup cloudflare is therefore a complete setup for every project
on the workstation, and make cf-setup is the per-project override. The two
variables are wrangler’s own names, CLOUDFLARE_ACCOUNT_ID and
CLOUDFLARE_API_TOKEN, so the value in a file reaches the deploy untranslated.
Each scope is read on its own, so a project file is what wins, whichever spelling
it uses: the older CF_ACCOUNT_ID / CF_API_TOKEN names are deprecated aliases,
still read so an existing config keeps working, and written by nothing.
Two targets make all of that visible rather than guessable:
make cf-vars # the resolved id, which scope supplied it, both file pathsmake cf-check-credentials # fails loudly, naming both paths and both fixes, when nothing resolvesThe full guide
Section titled “The full guide”Provider-by-provider setup, the resolution flow in detail, staging-versus-production credential files, and the per-provider variable names are all in the corpus:
→ Infrastructure Configuration Guide
Related
Section titled “Related”- Cloudflare deploy: what the credentials are for
- Compose & env conventions: the project-level env layers, which are a different thing