chore: add .env.example and wire compose.yml to env vars
- .env.example documents all env vars with defaults (postgres creds, DATABASE_URL, TTLs, pool sizes) - compose.yml reads postgres credentials and app config from .env via env_file - .gitignore: track .env.example, ignore .env
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
# PostgreSQL
|
||||
POSTGRES_DB=goyomi
|
||||
POSTGRES_USER=goyomi
|
||||
POSTGRES_PASSWORD=goyomi
|
||||
|
||||
# App
|
||||
DATABASE_URL=postgres://goyomi:goyomi@postgres:5432/goyomi?sslmode=disable
|
||||
FLARESOLVERR_URL=http://flaresolverr:8191
|
||||
ADDR=:8080
|
||||
|
||||
# Connection pool
|
||||
DB_MAX_CONNS=10
|
||||
DB_MIN_CONNS=2
|
||||
|
||||
# Cache TTLs (seconds)
|
||||
MANGA_LIST_TTL_SECONDS=600
|
||||
MANGA_DETAIL_TTL_SECONDS=3600
|
||||
CHAPTER_LIST_TTL_SECONDS=600
|
||||
+1
-2
@@ -2,9 +2,8 @@
|
||||
/goyomi
|
||||
/cmd/server/server
|
||||
|
||||
# Environment
|
||||
# Environment (copy .env.example → .env and fill in values)
|
||||
.env
|
||||
.env.*
|
||||
|
||||
# Go tooling
|
||||
*.test
|
||||
|
||||
+6
-8
@@ -3,13 +3,13 @@ services:
|
||||
image: postgres:16-alpine
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB: goyomi
|
||||
POSTGRES_USER: goyomi
|
||||
POSTGRES_PASSWORD: goyomi
|
||||
POSTGRES_DB: ${POSTGRES_DB}
|
||||
POSTGRES_USER: ${POSTGRES_USER}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U goyomi -d goyomi"]
|
||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
@@ -25,11 +25,9 @@ services:
|
||||
app:
|
||||
build: .
|
||||
restart: unless-stopped
|
||||
env_file: .env
|
||||
ports:
|
||||
- "8080:8080"
|
||||
environment:
|
||||
DATABASE_URL: postgres://goyomi:goyomi@postgres:5432/goyomi?sslmode=disable
|
||||
FLARESOLVERR_URL: http://flaresolverr:8191
|
||||
- "${ADDR:-8080}:8080"
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
|
||||
Reference in New Issue
Block a user