Skip to main content

Configuration values, placeholders, and secret snapshots

Choose a substitution form based on the field and when the value must become available. This reference covers the Caddy Security integration in the AuthCrunch v1.8.1 distribution.

Choose when to supply a value​

FormWhen it resolvesExample
{$NAME}The Caddyfile adapter substitutes it before parsing directives. Adapted JSON can contain the resulting value.Supply the absolute path in path {$ACCOUNTS_DB} for a SQLite identity store.
{env.NAME}The process provisioning a supported field reads its environment. On a live reload that process is the serving Caddy process.Supply a portal signing key in crypto key sign-verify {env.JWT_SIGNING_KEY}.
secrets:MANAGER:FIELDAuthCrunch's Caddy app looks up an entire value after Caddy placeholder replacement.Read one field with crypto key sign-verify secrets:signing:jwt.key.
{claims.NAME}A supported transform action resolves a claim during login.Add a derived action value after the provider has supplied identity claims.

Use only the syntax supported by the field. Caddyfile adaptation can expand a variable into a companion's literal setting, while the same field can reject a runtime placeholder. For example, an SQLite backend path must already be an absolute path when its parser sees it. Values sent through Caddy's admin API are native JSON. They do not pass through Caddyfile substitution.

The Caddy app expects exactly three colon-separated parts for a secret reference. The field is an exact top-level key, including any dots. The manager returns a string for the consumer. It can store other JSON types, but a numeric, boolean or object value cannot stand in for a string. The consumer still validates the resulting string and can refuse an empty value. Supply the representation the consumer expects, such as a stored password hash where the directive accepts a hash.

Check which fields resolve​

AreaSupported examplesBoundary
Root statestate { directory … }Resolution still has to produce a valid directory. Persistent state retains its stop/start ownership rules.
Crypto and access profilesCrypto instruction arguments, a portal's selected access_signer, and profile issuer, audience and verification key IDsNamed signer module settings are literal.
Portal featuresCaddyfile cookie statements, refresh and Documents settings, selected UI stringsNative JSON cookie path and domain settings resolve. Use the deferred Caddyfile form for runtime cookie names and prefixes.
Identity providersBuilt-in OAuth provider arguments, built-in LDAP/SAML parameter fields, including an explicit local attachment targetA configured attachment that resolves to an empty name fails. Companion ticket backend settings are literal.
Credentials, mail and signupRaw core credential, messaging and registration argumentsAlready typed native configurations need their final values. Companion declarations use their module grammar.
Direct OAuthProvider selector, public origin, base path and cookie namesUse the direct policy configuration.
HTTP handlersThe portal name in authenticate with {env.PORTAL} and policy name in authorize with {env.POLICY}The handler resolves the selector. Names declared inside security stay literal.

AuthCrunch does not replace every string in a Caddy app. Use literal values for portal and policy names, portal store/provider enable lists, authorization ACL rules, trusted redirect settings and policy auth/forbidden URLs. A supported transform action can combine environment and claim templates. ACL match values inside a transform remain literal with respect to claims. Read the backend field reference for module declarations and selectors.

Preserve deferred values in native JSON​

When designated Caddyfile blocks contain runtime references, adaptation preserves their original arguments under apps.security. At provisioning the app resolves each argument and reparses the resulting block. This preserves spaces or quotes as part of the value and prevents a substituted value from being interpreted again. For example, a provider can derive its final client ID only after the secret lookup succeeds.

FeatureDeferred key under apps.security
Upstream OAuth provideroauth_provider_directives
Direct OAuth authorization policyoauth_authorization_directives
Portal cookiesportal_cookie_directives
Portal refreshportal_token_refresh_directives
Portal and policy access-token profilesportal_access_token_profile_directives and policy_access_token_profile_directives
Portal Documents APIportal_documents_directives

Copy the complete adapted app if you plan to provision it as native JSON. The config subtree by itself can omit the original arguments the app needs to reparse. Keep the adapted typed OAuth provider entry that identifies its deferred block. For Documents, refresh, direct OAuth and access-token profiles, use one typed or deferred definition for each consumer. A deferred cookie collection supplies the whole cookie configuration. If refresh itself is deferred, AuthCrunch delays that portal's cookie checks until it can validate the effective refresh cookie names together with the portal cookie names.

Validate and activate a new snapshot​

  1. Use the deployed executable with adapt --config Caddyfile --adapter caddyfile to verify grammar. Handle the adapted output as private if lexical environment substitution supplied a secret.
  2. Provision the referenced records, then use validate --config Caddyfile --adapter caddyfile in an isolated environment with the intended service identity and environment. Validation provisions modules and can contact their stores. Use disposable writable paths and isolated credentials for a rehearsal. Test live sign-in or authorization separately.
  3. To adopt a changed SQLite, Consul or DynamoDB snapshot with an unchanged stateless configuration and an available Caddy admin endpoint, run authcrunch reload --config Caddyfile --adapter caddyfile --force. A normal reload can return success for identical JSON without provisioning anything again. Change a serving process's environment through its service configuration and restart it. A Caddy process with an exclusive persistent root needs a drained stop and start.
  4. Verify the intended consumer with a request that depends on the new value. A failed candidate reload leaves the running configuration active. Restoring a valid record in storage makes a subsequent candidate possible. A secret written successfully in storage can still be unusable by a consumer.

Use the secrets guide for storage, record updates and key overlap. A change to an access signing key can deny still-unexpired credentials if the corresponding old verification key is no longer present.

Agentic Prompts​

Choose a substitution form for each field
Primary authorities, before website documentation:
https://github.com/greenpau/caddy-security/blob/main/AGENTS.md
https://github.com/greenpau/caddy-security/tree/main/.codex/skills
https://github.com/greenpau/go-authcrunch/blob/main/AGENTS.md
https://github.com/greenpau/go-authcrunch/tree/main/.codex/skills
Read each root AGENTS.md first, any scoped AGENTS.md applying to inspected
paths, then relevant SKILL.md files and implementation/test references.
Relevant skills: configuration-runtime-resolution, configuration-secrets,
configuration-identity-stores, authentication-portal-cookies.
Distinguish main, Caddy Security v1.8.1 / go-authcrunch v1.7.1 and my
deployed version. Resolve disagreements with linked code and tests. Use
only synthetic or redacted inputs. Ask for pasted excerpts if needed.
Secondary context: https://docs.authcrunch.com/docs/operations/configuration-resolution

For my redacted field list, identify what resolves at adaptation, what
resolves at provisioning, and where an input must already be literal.
Show where an adapted file can contain private values.
Inspect a native JSON handoff
Primary authorities, before website documentation:
https://github.com/greenpau/caddy-security/blob/main/AGENTS.md
https://github.com/greenpau/caddy-security/tree/main/.codex/skills
https://github.com/greenpau/go-authcrunch/blob/main/AGENTS.md
https://github.com/greenpau/go-authcrunch/tree/main/.codex/skills
Read each root AGENTS.md first, any scoped AGENTS.md applying to inspected
paths, then relevant SKILL.md files and implementation/test references.
Relevant skills: configuration-runtime-resolution, configuration-oauth-providers,
configuration-authentication, configuration-authentication-cookies.
Distinguish the released and main-branch implementations with code and
tests. Use synthetic or redacted config only. Ask for pasted excerpts if needed.
Secondary context: https://docs.authcrunch.com/docs/operations/configuration-resolution

Compare adaptation and provisioning for a portal whose refresh or Documents
block includes an environment value. Explain where the original arguments
appear and what changes if a JSON exporter keeps only apps.security.config.
Diagnose a secret that changed in storage
Primary authorities, before website documentation:
https://github.com/greenpau/caddy-security/blob/main/AGENTS.md
https://github.com/greenpau/caddy-security/tree/main/.codex/skills
https://github.com/greenpau/go-authcrunch/blob/main/AGENTS.md
https://github.com/greenpau/go-authcrunch/tree/main/.codex/skills
Read each root AGENTS.md first, applicable scoped AGENTS.md files, then the
selected backend's AGENTS.md, relevant skills and source/test references.
Relevant skills: configuration-runtime-resolution, configuration-secrets,
configuration-state and the chosen companion's storage skill.
Distinguish main from my deployed release. Use only redacted values and ask
for excerpts if sources are unavailable.
Secondary context: https://docs.authcrunch.com/docs/operations/configuration-resolution

Help me distinguish a malformed value, a failed candidate and a successful
unchanged-JSON reload. Explain how to verify the active value with a
synthetic request and how a persistent root changes the procedure.

Source Code References​