diff --git a/.env.example b/.env.example index ff6bf09..9051ed8 100644 --- a/.env.example +++ b/.env.example @@ -1,9 +1,9 @@ -# ── SQLite (default for local dev) ── -DB_DRIVER=sqlite -SQLITE_PATH=./data/surprise.db +# ── Postgres (default) ── +DB_DRIVER=postgres +DATABASE_URL=postgres://surprise:surprise_dev_password@localhost:5432/surprise?sslmode=disable -# ── Postgres (uncomment and set DB_DRIVER=postgres to use) ── -# DATABASE_URL=postgres://surprise:surprise_dev_password@localhost:5432/surprise?sslmode=disable +# ── SQLite (set DB_DRIVER=sqlite to use) ── +# SQLITE_PATH=./data/surprise.db PORT=8080 CORS_ORIGIN=http://localhost:5173,http://127.0.0.1:5173 diff --git a/backend/internal/config/config.go b/backend/internal/config/config.go index 7b899a8..beeec0a 100644 --- a/backend/internal/config/config.go +++ b/backend/internal/config/config.go @@ -33,10 +33,10 @@ func Load() Config { } return Config{ - DBDriver: envOrDefault("DB_DRIVER", "sqlite"), + DBDriver: envOrDefault("DB_DRIVER", "postgres"), Port: envOrDefault("PORT", "8080"), - DatabaseURL: envOrDefault("DATABASE_URL", ""), - SQLitePath: envOrDefault("SQLITE_PATH", ""), + DatabaseURL: envOrDefault("DATABASE_URL", "postgres://surprise:surprise_dev_password@localhost:5432/surprise?sslmode=disable"), + SQLitePath: envOrDefault("SQLITE_PATH", "./data/surprise.db"), CORSOrigin: envOrDefault("CORS_ORIGIN", "http://localhost:5173,http://127.0.0.1:5173"), SessionSecret: envOrDefault("SESSION_SECRET", "local-development-session-secret-change-me"), CookieSecure: parseBoolEnv("COOKIE_SECURE", false), diff --git a/docker-compose.yml b/docker-compose.yml index ec891ff..4e2eb80 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,7 @@ services: postgres: image: postgres:16-alpine + container_name: sndit-postgres restart: unless-stopped environment: POSTGRES_DB: surprise @@ -19,6 +20,7 @@ services: minio: image: minio/minio:latest + container_name: sndit-minio restart: unless-stopped command: server /data --console-address ":9001" environment: @@ -38,6 +40,7 @@ services: api: build: ./backend + container_name: sndit-api restart: unless-stopped ports: - "${PORT:-8080}:8080" @@ -62,6 +65,7 @@ services: migrate: build: ./backend + container_name: sndit-migrate command: ["migrate", "-dir", "/migrations"] environment: DB_DRIVER: postgres @@ -74,6 +78,7 @@ services: seed: build: ./backend + container_name: sndit-seed command: ["seed"] environment: DB_DRIVER: postgres @@ -87,6 +92,7 @@ services: context: ./frontend args: VITE_API_BASE_URL: "" + container_name: sndit-frontend restart: unless-stopped ports: - "${FRONTEND_PORT:-8081}:80"