Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ __pycache__/
.DS_Store
**/.DS_Store
.env
.env.*
13 changes: 9 additions & 4 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# Plain configuration. Secrets (DB URL with its password, JWT secret, OAuth client
# secrets, private keys) go in .env.secrets next to it: see .env.secrets.sample.
# docker compose passes both files to the container; scripts/asc.py and play.py load
# .env then .env.secrets. Each key belongs in exactly one of the two.

# Required in production
ENVIRONMENT=production
DATABASE_URL=mysql+pymysql://user:pass@shared-mysql:3306/flyfun
JWT_SECRET=change-me-in-production
# DATABASE_URL: in .env.secrets
# JWT_SECRET: in .env.secrets

# OAuth (shared with flyfun-weather — same credentials)
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
# GOOGLE_CLIENT_SECRET: in .env.secrets

# Apple Sign In – native iOS token validation
APPLE_APP_IDS=net.ro-z.flyfun-forms
Expand All @@ -14,7 +19,7 @@ APPLE_APP_IDS=net.ro-z.flyfun-forms
# APPLE_CLIENT_ID=
# APPLE_TEAM_ID=
# APPLE_KEY_ID=
# APPLE_PRIVATE_KEY=
# APPLE_PRIVATE_KEY: in .env.secrets

# Optional: airports.db for name resolution
# AIRPORTS_DB=/app/data/airports.db
Expand Down
14 changes: 14 additions & 0 deletions .env.secrets.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# FlyFun Forms secrets: copy to .env.secrets (gitignored, keep it mode 600) and fill in.
# Plain configuration is in .env (see .env.sample). docker compose passes both files to
# the container. In the owner's setup this file is sops-encrypted in the config repo and
# decrypted by syncfiles on the host that uses it: don't hand-edit it there.

# Required in production
DATABASE_URL=mysql+pymysql://user:pass@shared-mysql:3306/flyfun
JWT_SECRET=change-me-in-production

# OAuth (shared with flyfun-weather: same credentials; GOOGLE_CLIENT_ID is in .env)
GOOGLE_CLIENT_SECRET=

# Optional: Apple web OAuth private key (only if using the browser-based flow)
# APPLE_PRIVATE_KEY=
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ __pycache__/
*.pyc
*.egg-info/
.env
# .env.secrets (sops-managed secrets) and any other .env.* file; the samples stay tracked
.env.*
!.env.sample
!.env.secrets.sample
# App Store Connect keys live in ~/.appstoreconnect/private_keys/; this guards
# against an accidental `git add` of a downloaded AuthKey_*.p8.
*.p8
Expand Down
6 changes: 5 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ services:
# published ports bypass the host firewall, so "8030:8030" would expose
# plain HTTP (no TLS, no Caddy limits) on the public interface.
- "127.0.0.1:8030:8030"
env_file: .env
env_file:
- .env
# secrets split out of .env (sops-managed on the host); optional until prod has it
- path: .env.secrets
required: false
environment:
- ENVIRONMENT=production
volumes:
Expand Down
1 change: 1 addition & 0 deletions scripts/asc.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,7 @@ def main() -> None:

if load_dotenv is not None:
load_dotenv(Path(__file__).resolve().parent.parent / ".env")
load_dotenv(Path(__file__).resolve().parent.parent / ".env.secrets") # sops-managed secrets, if present

config = AscConfig.from_env()
asc = Asc(
Expand Down
1 change: 1 addition & 0 deletions scripts/play.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ def main() -> None:
args = build_parser().parse_args()
if load_dotenv is not None:
load_dotenv(REPO / ".env")
load_dotenv(REPO / ".env.secrets") # sops-managed secrets, if present
key = Path(os.environ.get("PLAY_SERVICE_ACCOUNT_JSON") or DEFAULT_KEY).expanduser()
play = Play(os.environ.get("PLAY_PACKAGE_NAME") or DEFAULT_PACKAGE, key, getattr(args, "dry_run", False))
COMMANDS[args.command](play, args)
Expand Down
Loading