fix: update environment variable handling in Docker Compose files and improve contributing documentation

This commit is contained in:
Thibault Pouch
2026-03-19 21:27:56 +01:00
parent 3714200dc1
commit 5268e7618b
6 changed files with 24 additions and 7 deletions

12
.env.example Normal file
View File

@@ -0,0 +1,12 @@
# Host-side port for the API container (container port remains 3000)
API_HOST_PORT=3001
DATABASE_URL="postgresql://user:password@localhost:5432/nest_db"
JWT_SECRET="change_me_to_a_long_random_string"
PORT=3000
ADMIN_USERNAME="admin"
ADMIN_EMAIL="admin@example.com"
ADMIN_PASSWORD="change_me"
FRONT_ORIGIN="http://localhost:5173"
INTRA_ORIGIN="http://localhost:5174"

View File

@@ -49,7 +49,7 @@ npm install
### 3. Set Up Environment
Create `.env` files based on the examples in each project. See the main [README.md](./README.md) for required environment variables.
Create a root `.env` file from `.env.example` (`cp .env.example .env`) and adjust values as needed. See the main [README.md](./README.md) for required environment variables.
### 4. Create a Branch

View File

@@ -23,9 +23,11 @@ nest-intra/ # Staff-only internal portal (React + Vite)
### 1. Backend Setup
```bash
cd nest-backend
# from repository root
cp .env.example .env
# Edit .env with your database credentials
# Edit .env with your credentials
cd nest-backend
npm install
npm run db:push # Initialize database schema
npm run db:seed # Populate with sample data
@@ -35,6 +37,7 @@ npm run dev # Start dev server (http://localhost:3000)
#### Backend Environment Variables
```env
API_HOST_PORT=3001
DATABASE_URL="postgresql://user:password@localhost:5432/nest_db"
JWT_SECRET="your-secret-key"
PORT=3000

View File

@@ -18,7 +18,7 @@ services:
image: git.crowmate.fr/crowmate/nest-api:latest
restart: unless-stopped
ports:
- "3000:3000"
- "${API_HOST_PORT:-3001}:3000"
environment:
DATABASE_URL: postgresql://nest_user:nest_password@db:5432/nest_db
depends_on:

View File

@@ -18,9 +18,9 @@ services:
build: ./nest-backend
restart: unless-stopped
ports:
- "3000:3000"
- "${API_HOST_PORT:-3001}:3000"
env_file:
- ./nest-backend/.env
- ./.env
environment:
DATABASE_URL: postgresql://nest_user:nest_password@db:5432/nest_db
depends_on:

View File

@@ -18,7 +18,9 @@ services:
build: .
restart: unless-stopped
ports:
- "3000:3000"
- "${API_HOST_PORT:-3001}:3000"
env_file:
- ../.env
environment:
DATABASE_URL: postgresql://nest_user:nest_password@db:5432/nest_db
JWT_SECRET: ${JWT_SECRET:-change_me_in_production}