### Configure Environment and Secrets for Axum

#### Summary
Configuration and secrets for an Axum app on Ample. Verified on Axum: an --env value delivered encrypted and reported as present without being echoed (secret=set). Build and start: `cargo build --release` in the Rust builder image (stable toolchain, Cargo.lock committed, pure-Rust dependencies), then the release binary on the ubuntu-24.04 template reading PORT and DATABASE_URL.

#### Requirements
- **Resource Requirements:** `primitive:compute`
- **Infrastructure Requirements:**
  - **Compute**
    - Apps run in isolated x86_64 Firecracker microVMs that auto-pause when idle and wake on request; sizes are the priced VM sizes.

#### Prerequisites
- A Axum project (`cargo build --release` in the Rust builder image (stable toolchain, Cargo.lock committed, pure-Rust dependencies), then the release binary on the ubuntu-24.04 template reading PORT and DATABASE_URL)
- An Ample account token with `servers:write`

#### Workflow Steps
1. **Build and Start**  
   `cargo build --release` in the Rust builder image (stable toolchain, Cargo.lock committed, pure-Rust dependencies), then the release binary on the ubuntu-24.04 template reading PORT and DATABASE_URL; the server must bind 0.0.0.0 on PORT.

2. **Pass Values on Deploy**  
   Use `--env KEY=value` (repeatable) or `--env-file`; values are encrypted at rest and reused on redeploys. Declare names only in ample.toml.  
   Command: `ample deploy . --name --public --env MY_SECRET=...`

3. **Verify**  
   Fetch the live URL and `/p/configuration-secrets` on the example; on failure, read the build and runtime logs.  
   Command: `ample logs --kind build`

#### Examples
- **Axum Pattern Fixture**  
  Verified configuration and secrets on Axum.

#### Success Checks
1. App responds on its public URL  
   Kind: `http_get`  
   Path: `/`  
   Expect: `ample canary axum patterns`

2. Configuration-secrets check from the example  
   Kind: `http_get`  
   Path: `/p/configuration-secrets`  
   Expect: `see the pattern fixture checks`

#### Limitations
- Verified on the ubuntu-24.04 template at s-1vcpu-2gb; other sizes and Axum major versions are not verified.
- Region, compliance attestations, and request-duration limits are unknown and not claimed.

#### Cost Estimate
- **Currency:** USD  
- **Monthly Amount:** 5.0  
- **Components:**  
  - App server: size `s-1vcpu-1gb`, quantity 1.0, monthlyAmount 5.0

_Always-on monthly price of the tested sizes; apps auto-pause when idle. Buckets are allocation-priced per quota and not included._

#### Evidence Summary
- **Kind:** canary_run  
  **Summary:** Axum pattern fixture deployed on Ample.  
  Observed At: 2026-09-21T02:46:37Z  
  Implementation Revision: 1d28ae0-dirty (CLI 0.1.21)  
  Expires At: 2027-03-20T02:46:37Z

#### Last Verified At
- 2026-09-21T02:46:37Z

#### Input Schema
- **Required:**  
  - env: Encrypted environment variables  
  - name: App name  
  - path: Project directory or ample.toml service  
  (max length restrictions apply)

#### Formats
- HTML: [Ample Documentation](/content/guides/axum/configuration-secrets/index.html)
- Markdown: [Markdown Format](/content/guides/axum/configuration-secrets.md)
- JSON: [API Format](https://api.ample.computer/v1/catalog/recipes/page%3Aguides%3Aaxum%3Aconfiguration-secrets)
