Skip to content

Secrets

Secrets live in AWS Secrets Manager under the woos-connectors member account (id 127262955926), region eu-west-1. The operations repo owns the provisioning (empty containers); values are seeded out of band.

How the app reads secrets

Each connector uses config.get_secret(name) which:

  1. Checks for an env var (name uppercased, dashes replaced with underscores).
  2. Falls back to a single JSON blob in Secrets Manager, pointed at by the <CONNECTOR>_SECRET_ID env var the Lambda carries, parsed once and cached with functools.cache.

So local dev uses env vars; Lambda reads from Secrets Manager, zero code changes between the two.

Secret containers

Lane Container ID
Monoprix prod woos-connectors/monoprix
Monoprix dev woos-connectors/monoprix/dev
McDonald's prod woos-connectors/mcdonalds
McDonald's dev woos-connectors/mcdonalds/dev

The Lambda environment variable (MONOPRIX_SECRET_ID or MCDONALDS_SECRET_ID) points at the right one per lane.

Seeding or rotating a secret

The container holds one JSON object; keys are the names used in get_secret(name). Rotate or seed the whole blob at once:

cat > /tmp/mcdonalds.json <<'EOF'
{
  "api-base-url": "...",
  "client-id": "...",
  "client-secret": "...",
  "woosmap-private-key": "...",
  "woosmap-base-url": "...",
  "slack-bot-token": "...",
  "slack-channel-id": "..."
}
EOF

aws-vault exec woos-connectors -- aws secretsmanager put-secret-value \
  --region eu-west-1 \
  --secret-id woos-connectors/mcdonalds \
  --secret-string file:///tmp/mcdonalds.json

shred -u /tmp/mcdonalds.json

config.get_secret always reads the current secret version, so changes take effect on the next Lambda cold start.

Per-connector keys

Monoprix

JSON key Env var (local dev)
salesforce-base-url SALESFORCE_BASE_URL
salesforce-client-id SALESFORCE_CLIENT_ID
salesforce-client-secret SALESFORCE_CLIENT_SECRET
salesforce-env SALESFORCE_ENV
woosmap-private-key WOOSMAP_PRIVATE_KEY

McDonald's

JSON key Env var (local dev)
api-base-url API_BASE_URL
client-id CLIENT_ID
client-secret CLIENT_SECRET
woosmap-private-key WOOSMAP_PRIVATE_KEY
woosmap-base-url WOOSMAP_BASE_URL
slack-bot-token SLACK_BOT_TOKEN
slack-channel-id SLACK_CHANNEL_ID
profiles (prod only, see McDonald's) MCDONALDS_PROFILES

Adding secrets for a new connector

  1. Agree the key list with operations; they provision the empty containers (prod + dev) + the IAM policy that lets the Lambda role read them.
  2. Seed the JSON blob with aws secretsmanager put-secret-value.