Skip to content

Commit f10979e

Browse files
committed
fix backend CI
1 parent e28ea40 commit f10979e

4 files changed

Lines changed: 179 additions & 1 deletion

File tree

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
# config/ folder - centralized environment configuration
2323
# NOTE: .env.*.example files ARE tracked (they are templates)
2424
config/.env
25-
config/.env.*
2625
!config/.env.*.example
2726
!config/.env.*.md
2827

config/.env.dev

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# ==============================================================================
2+
# Development Environment Configuration
3+
# ==============================================================================
4+
# For LOCAL DEVELOPMENT only (Docker Compose local stack).
5+
# DO NOT load this file in GitHub Actions — use config/.env.test for CI
6+
# test jobs and config/.env.staging for staging deploy jobs.
7+
# NEVER commit real secrets to this file.
8+
# ==============================================================================
9+
10+
ENVIRONMENT=development
11+
PROJECT_NAME=myproject
12+
APP_VERSION=1.0.0
13+
DEBUG=true
14+
LOG_LEVEL=DEBUG
15+
16+
# Backend Server
17+
BACKEND_HOST=0.0.0.0
18+
BACKEND_PORT=8000
19+
BACKEND_RELOAD=true
20+
BACKEND_WORKERS=1
21+
API_TITLE=MyProject API
22+
API_DESCRIPTION=Development Environment
23+
API_VERSION=1.0.0
24+
25+
# Database - Local PostgreSQL
26+
DATABASE_USER=postgres
27+
DATABASE_PASSWORD=postgres
28+
DATABASE_HOST=postgres
29+
DATABASE_PORT=5432
30+
DATABASE_NAME=myproject_dev
31+
DATABASE_POOL_SIZE=5
32+
DATABASE_MAX_OVERFLOW=5
33+
DATABASE_POOL_TIMEOUT=30
34+
DATABASE_ECHO=true
35+
36+
# Security - Dev Keys (USE ONLY IN LOCAL DEV)
37+
JWT_SECRET_KEY=cR3QvM7K1Rr6O4M1kXo5pQzF9vM3eS9uZ5aXK1hYbJt8g2YQ7pP9kV4cFh6D0nW8HkLm2SxAqTzB5N7uC
38+
JWT_ALGORITHM=HS256
39+
JWT_EXPIRE_MINUTES=60
40+
JWT_REFRESH_EXPIRE_DAYS=7
41+
42+
# CORS - Local Development
43+
ALLOWED_ORIGINS=http://localhost:4200,http://127.0.0.1:4200
44+
CORS_ALLOW_CREDENTIALS=true
45+
CORS_ALLOW_METHODS=GET,POST,PUT,DELETE,OPTIONS,PATCH
46+
CORS_ALLOW_HEADERS=Content-Type,Authorization
47+
48+
# Security Headers - Disabled for local dev
49+
ENABLE_HTTPS_REDIRECT=false
50+
ENABLE_HSTS=false
51+
SECURE_COOKIES=false
52+
53+
# Frontend
54+
FRONTEND_URL=http://localhost:4200
55+
API_BASE_URL=http://localhost:8000
56+
57+
# Logging - Console output for development
58+
LOG_FORMAT=text
59+
LOG_OUTPUT=console
60+
61+
# AWS - Not needed for local dev
62+
AWS_REGION=us-east-1
63+
AWS_ACCESS_KEY_ID=
64+
AWS_SECRET_ACCESS_KEY=
65+
66+
# Monitoring - Disabled for local dev
67+
SENTRY_DSN=
68+
DATADOG_API_KEY=
69+
ENABLE_METRICS=false
70+
71+
# Rate Limiting - Relaxed for development
72+
RATE_LIMIT_ENABLED=false

config/.env.production

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# ==============================================================================
2+
# Production Environment Configuration
3+
# ==============================================================================
4+
# Non-secret production settings loaded by release workflows.
5+
# Secrets must come from GitHub Secrets or AWS Secrets Manager.
6+
# ==============================================================================
7+
8+
# Environment & Application
9+
ENVIRONMENT=production
10+
PROJECT_NAME=mypythonproject1
11+
APP_VERSION=1.0.0
12+
DEBUG=false
13+
LOG_LEVEL=WARNING
14+
API_TITLE=MyProject API
15+
API_DESCRIPTION=Production Environment
16+
API_VERSION=1.0.0
17+
18+
# Frontend & API URLs
19+
FRONTEND_URL=https://myproject.com
20+
API_BASE_URL=https://api.myproject.com
21+
ALLOWED_ORIGINS=https://myproject.com,https://www.myproject.com
22+
CORS_ALLOW_CREDENTIALS=true
23+
CORS_ALLOW_METHODS=GET,POST,PUT,DELETE,OPTIONS,PATCH
24+
CORS_ALLOW_HEADERS=Content-Type,Authorization
25+
26+
# Database (non-secret connection metadata)
27+
DATABASE_HOST=rds-prod.xxxxxxxxxxxx.us-east-1.rds.amazonaws.com
28+
DATABASE_PORT=5432
29+
DATABASE_NAME=myproject_production
30+
DATABASE_POOL_SIZE=20
31+
DATABASE_MAX_OVERFLOW=10
32+
DATABASE_POOL_TIMEOUT=30
33+
DATABASE_ECHO=false
34+
35+
# AWS / ECS
36+
AWS_REGION=us-east-1
37+
AWS_ACCOUNT_ID=123456789012
38+
ECS_CLUSTER=myproject-prod-cluster
39+
ECS_SERVICE_PREFIX=myproject-prod
40+
41+
# Security
42+
JWT_ALGORITHM=HS256
43+
JWT_EXPIRE_MINUTES=15
44+
JWT_REFRESH_EXPIRE_DAYS=7
45+
ENABLE_HTTPS_REDIRECT=true
46+
ENABLE_HSTS=true
47+
HSTS_MAX_AGE=31536000
48+
SECURE_COOKIES=true
49+
50+
# CI/CD Workflow Tooling
51+
TF_VERSION=1.5.0
52+
PROJECT_ROOT=.

config/.env.test

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# ==============================================================================
2+
# Test Environment Configuration
3+
# ==============================================================================
4+
# Used when running pytest locally (outside Docker).
5+
# DATABASE_HOST=localhost so tests reach the Docker-exposed postgres on 5432.
6+
# ==============================================================================
7+
8+
ENVIRONMENT=development
9+
PROJECT_NAME=myproject
10+
APP_VERSION=1.0.0
11+
DEBUG=false
12+
LOG_LEVEL=WARNING
13+
14+
# Backend Server
15+
BACKEND_HOST=0.0.0.0
16+
BACKEND_PORT=8000
17+
BACKEND_RELOAD=false
18+
BACKEND_WORKERS=1
19+
API_TITLE=MyProject API
20+
API_DESCRIPTION=Test Environment
21+
API_VERSION=1.0.0
22+
23+
# Database - localhost (Docker port-mapped to 5432)
24+
DATABASE_USER=postgres
25+
DATABASE_PASSWORD=postgres
26+
DATABASE_HOST=localhost
27+
DATABASE_PORT=5432
28+
DATABASE_NAME=myproject_test
29+
DATABASE_POOL_SIZE=5
30+
DATABASE_MAX_OVERFLOW=5
31+
DATABASE_POOL_TIMEOUT=30
32+
DATABASE_ECHO=false
33+
34+
# Security - Test Keys
35+
JWT_SECRET_KEY=test-secret-key-do-not-use-in-production
36+
JWT_ALGORITHM=HS256
37+
JWT_EXPIRE_MINUTES=60
38+
JWT_REFRESH_EXPIRE_DAYS=7
39+
40+
# CORS
41+
ALLOWED_ORIGINS=http://localhost:4200,http://localhost:3000
42+
CORS_ALLOW_CREDENTIALS=true
43+
CORS_ALLOW_METHODS=GET,POST,PUT,DELETE,OPTIONS,PATCH
44+
CORS_ALLOW_HEADERS=Content-Type,Authorization
45+
46+
# Security Headers - Disabled for tests
47+
ENABLE_HTTPS_REDIRECT=false
48+
ENABLE_HSTS=false
49+
SECURE_COOKIES=false
50+
51+
# AWS / CI Tooling
52+
AWS_REGION=us-east-1
53+
TF_VERSION=1.5.0
54+
REGISTRY=ghcr.io
55+
PROJECT_ROOT=.

0 commit comments

Comments
 (0)