# Configure environment and secrets for Gin

## Summary
Configuration and secrets for a Gin app on Ample. Verified on Gin: an --env value delivered encrypted and reported as present without being echoed (secret=set). Build and start: CGO_ENABLED=0 go build -o app ./... then ./app on the ubuntu-24.04 template (go.sum committed for a reproducible build).

## Prerequisites
- A Gin project (CGO_ENABLED=0 go build -o app ./... then ./app on the ubuntu-24.04 template (go.sum committed for a reproducible build))  
- An Ample account token with servers:write

## Tested Configuration
- **Template**: ubuntu-24.04  
- **Runtime**: go  
- **Size**: s-1vcpu-1gb  
- **Build**: CGO_ENABLED=0 go build -o app ./...  
- **Start**: ./app

## Input Schema
- **env**: Encrypted environment variables  
- **name**: App name  
- **path**: Project directory or ample.toml service  
- **release_command**: Migration command run before activation

## Workflow Steps
1. **Build and start**  
   CGO_ENABLED=0 go build -o app ./... then ./app on the ubuntu-24.04 template (go.sum committed for a reproducible build); 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
- **Gin pattern fixture**  
  Verified configuration and secrets on Gin.  
  Source Reference: tests/deploy-canaries/gin-patterns

## Success Checks
- App responds on its public URL  
- Configuration-secrets check from the example

## Limitations
- Verified on the ubuntu-24.04 template at s-1vcpu-1gb; other sizes and Gin 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  
- **Basis**: size prices from pricing.toml (loaded by the API) at build revision 1ac5595375130d45290090e82ed0f554ccd45405-dirty

**Components**:  
- App server: s-1vcpu-1gb, Quantity: 1.0, Monthly Amount: 5.0

## Evidence Summary
- **Kind**: canary_run  
- **Summary**: Gin pattern fixture deployed on Ample (CGO_ENABLED=0 go build -o app ./... then ./app on the ubuntu-24.04 template (go.sum committed for a reproducible build)); for this guide: an --env value delivered encrypted and reported as present without being echoed (secret=set).  
- **Observed At**: 2026-09-21T01:15:54Z  
- **Expires At**: 2027-03-20T01:15:54Z

## Formats
- **HTML**: https://ample.computer/guides/gin/configuration-secrets  
- **Markdown**: https://ample.computer/guides/gin/configuration-secrets.md  
- **JSON**: https://api.ample.computer/v1/catalog/recipes/page%3Aguides%3Agin%3Aconfiguration-secrets

## Next Actions
1. **Browse the catalog index**  
2. **Search published recipes by intent, stack and constraints**  
3. **Prepare a side-effect-free deployment plan for an authorized project**  
4. **Read the existing agent authentication setup**  
5. **Browse Gin**  
6. **Browse Configure deployment**  
7. **Browse Public web service
