{
  "title": "The short version",
  "content": "Configure environment variables and secrets for a Flask app on Ample. Values passed with --env or --env-file are stored encrypted and injected at runtime; the platform never prints them and ample.toml declares only variable names. The fixture proves delivery by reporting whether the secret is set without echoing it.",
  "sections": [
    {
      "heading": "INFRASTRUCTURE",
      "content": {
        "whatItNeeds": [
          {
            "link": "https://ample.computer/discover/primitive/compute",
            "description": "verified (Apps run in isolated x86_64 Firecracker microVMs; sizes are the priced VM sizes.)"
          }
        ]
      }
    },
    {
      "heading": "PREREQUISITES",
      "content": [
        "Code that reads configuration from the process environment",
        "The secret values at hand for --env or an env file",
        "An Ample account token with servers:write"
      ]
    },
    {
      "heading": "STEP BY STEP",
      "content": [
        {
          "step": 1,
          "subheading": "Declare, do not commit",
          "details": "In ample.toml declare SMTP_KEY = { secret = true } style entries; never put literal secrets in the manifest."
        },
        {
          "step": 2,
          "subheading": "Pass values on deploy",
          "details": "Use --env KEY=value (repeatable) or --env-file .env.production; values are encrypted at rest and reused on redeploys.\n\n```
ample deploy . --name <app-name> --public --start \"python3 app.py\" --env CANARY_SECRET=...\n```"
        },
        {
          "step": 3,
          "subheading": "Confirm without echoing",
          "details": "Expose a route (/config) that reports secret=set or secret=missing, never the value."
        },
        {
          "step": 4,
          "subheading": "Verify",
          "details": "Fetch the live URL and run the success checks below. On failure read the build log, then the runtime log, fix the cause and deploy again; do not blind-retry.\n\n```
ample logs <deployment_id> --kind build\n```"
        }
      ]
    },
    {
      "heading": "EXAMPLES",
      "content": [
        "Flask secret probe canary (tests/deploy-canaries/flask-postgres-app): /config reports secret=set for an --env value delivered encrypted."
      ]
    },
    {
      "heading": "SUCCESS CHECKS",
      "content": "app sees the configured variable without exposing it (/config on the live URL, expect secret=set)"
    },
    {
      "heading": "COST",
      "content": "Estimated 5.00 USD per month (size prices from pricing.toml at build revision ca0b484a7a9957c573a88d3a32dc603c3c10135a).\n\n- app server x1 s-1vcpu-1gb: 5.00 USD\n\nUpper-bound monthly price of the tested sizes. Plan quotas and budgets apply."
    },
    {
      "heading": "EVIDENCE",
      "content": "canary_run on 2026-09-20T01:42:25Z at revision `199ff1dfd52683832ae75d3f98b53a7a4bff7f96 (CLI e3181f5)`: Flask app (waitress) using psycopg with an auto-provisioned managed PostgreSQL database: /items reported postgres=ok and /config confirmed the encrypted secret. (expires 2027-03-19T01:42:25Z)"
    },
    {
      "heading": "EXECUTION",
      "content": "MCP tool `ample_deploy` (registry `mcp:ample_deploy`), schema hash `876465fce906da0c` observed 2026-09-20T01:55:48.667900+00:00 at revision `199ff1dfd526`. Binding state at export: schema_changed. Required scopes: servers:write."
    },
    {
      "heading": "NEXT ACTIONS",
      "content": [
        "Browse the catalog index (GET /v1/catalog on the api origin; authentication not required, approval not required)",
        "Search published recipes by intent, stack and constraints (POST /v1/catalog/search on the api origin; authentication not required, approval not required)",
        "Prepare a side-effect-free deployment plan for an authorized project (POST /v1/catalog/plan on the api origin; authentication required, approval not required)",
        "Read the existing agent authentication setup (GET /mcp/setup on the api origin; authentication not required, approval not required)",
        "Browse Flask (GET /v1/catalog/nodes/stack%3Aframework-flask on the api origin; authentication not required, approval not required)",
        "Browse Configure deployment (GET /v1/catalog/nodes/intent%3Aconfigure-deployment on the api origin; authentication not required, approval not required)",
        "Browse Public web service (GET /v1/catalog/nodes/pattern%3Apublic-web-service on the api origin; authentication not required, approval not required)"
      ]
    },
    {
      "heading": "ABOUT THIS RECIPE",
      "content": {
        "identifiers": "Recipe page:guides:flask:configuration-secrets. Revision r1.",
        "release": "published",
        "support": "verified",
        "execution": "blocked (schema_changed: live tool schema differs from the recorded binding)",
        "formats": [
          "HTML: https://ample.computer/guides/flask/configuration-secrets",
          "Markdown: https://ample.computer/guides/flask/configuration-secrets.md",
          "JSON contract: https://api.ample.computer/v1/catalog/recipes/page%3Aguides%3Aflask%3Aconfiguration-secrets"
        ]
      }
    }
  ]
}
