We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Protecting Secrets

Moving a secret out of source code is only the first step. Local files that contain injected secrets also need to stay out of version control.

As a general rule, environment files should be ignored:

.env*
!.env.example

A committed .env.example conventionally documents the expected names with dummy values:

APP_ORIGIN=http://localhost:3030
PAWPAL_API_KEY=replace_with_your_pawpal_api_key

Developers can copy that template to .env and supply their own local values. In Go, a package such as godotenv can read the file during startup. Load .env first and then overlay the process environment so an explicitly injected value takes precedence.

Assignment

Bearly Secure requires runtime configuration but does not safely load local environment files. Add a protected local configuration workflow and use a stable download-signing key.

  1. openssl rand -hex 32
    
  2. go run ./cmd/server
    

With Bearly Secure still running, run and submit the CLI tests from a separate terminal in the project root.