Decisions

  • Pending: Use python-dotenv or alternative for loading env vars?

User Tasks


FR-015: Secrets & Environment Management

Summary

Establish a strategy for managing API keys, credentials, and environment-specific configuration.

Problem / Motivation

As Opus grows, it will need API keys and credentials for: email (FR-062), health/finance APIs (FR-033), VPS SSH keys (FR-025), Telegram bot tokens (FR-032), and more. Without a strategy, secrets end up hardcoded, committed to git, or scattered across files.

Proposed Solution

Standard .env file with .env.example template, loaded via python-dotenv or similar. Git-ignored, documented, easy to replicate on VPS.


Open Questions

No open questions.


Phase Overview

PhaseDescriptionStatus
Phase 1.env setup + conventions
Phase 2Vault-based secrets (optional)

Phase 1: .env Setup —

Goal: Establish the standard .env pattern for secret management.

File / FeatureDetailsOwnerStatus
.env.exampleTemplate with all expected variables (empty values)opus
.gitignoreEnsure .env is ignoredopus
python-dotenvAdd dependency, load in src/opus configopus
DocumentationWhere secrets go, how to add new onesopus

Phase 2: Advanced (Optional) —

Goal: Encrypted secrets and rotation for multi-device sync.

File / FeatureDetailsOwnerStatus
Vault-based secretsEncrypted secrets in vault for sync between devicesopus
Secret rotationReminders for expiring keysopus

Acceptance Criteria:

  • .env.example exists with documented variables
  • .env is in .gitignore
  • Python code loads env vars via standard method
  • Adding a new secret has a documented process

Notes:

  • Not needed until external integrations start (FR-062, FR-033, FR-032)
  • But good to establish early so the pattern exists
  • Keep it simple — .env + python-dotenv is enough for now

Prerequisites / Gap Analysis

Requirements

RequirementDescription
REQ-1FR-009 (Python Project Scaffold) for dependency management

Current State

ComponentStatusDetails
.envDoes not exist
.env.exampleDoes not exist
.gitignoredoneExists but may not cover .env

Gap (What’s missing?)

GapEffortBlocker?
Entire secrets infrastructureLowNo

Test

Manual tests

TestExpectedOwnerActualLast
.env is git-ignoredgit status does not show .envopuspending-
.env.example existsTemplate with documented variablesopuspending-
Python loads env varsos.environ populated from .envopuspending-

AI-verified tests

ScenarioExpected behaviorVerification method

E2E tests

ScenarioAssertion

Integration tests

ComponentCoverage

Unit tests

ComponentTestsCoverage

History

DateEventDetails
2026-02-27Created
2026-02-27RenumberedFrom FR-030 to FR-015
2026-02-28ReformattedAligned to feature-request template

References

  • FR-009 (Python Project Scaffold) — prerequisite for dependency management
  • FR-062 (Email/WhatsApp Access) — will need secrets
  • FR-025 (VPS Deployment) — will need SSH keys