Skip to content
Open
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
3 changes: 2 additions & 1 deletion apps/server-nestjs/.env-example
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ KEYCLOAK_REDIRECT_URI=http://localhost:8080
KEYCLOAK_JWKS_CACHE_TTL_MS=300000
# JWKS fetch timeout in milliseconds (default 1000 = 1 s)
KEYCLOAK_JWKS_TIMEOUT_MS=1000

# Interface d'écoute du serveur backend
SERVER_HOST=localhost
# Port d'écoute du serveur backend
SERVER_PORT=3001
# URL de connexion à la base de données PostgreSQL (format Prisma)
Expand Down
3 changes: 2 additions & 1 deletion apps/server-nestjs/.env.docker-example
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ KEYCLOAK_REDIRECT_URI=http://localhost:8080
KEYCLOAK_JWKS_CACHE_TTL_MS=300000
# JWKS fetch timeout in milliseconds (default 1000 = 1 s)
KEYCLOAK_JWKS_TIMEOUT_MS=1000

# Interface d'écoute du serveur backend
SERVER_HOST=0.0.0.0
# Port d'écoute du serveur dans le réseau Docker
SERVER_PORT=3001
# URL de connexion PostgreSQL (utilise le nom de service Docker 'postgres')
Expand Down
6 changes: 5 additions & 1 deletion apps/server-nestjs/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ async function bootstrap() {
const documentFactory = () => SwaggerModule.createDocument(app, swaggerConfig)
SwaggerModule.setup('swagger-ui-server-nestjs', app, documentFactory)

await app.listen(config.port ?? 0)
await app.listen(config.port, config.host)

const serverUrl = await app.getUrl()
const logger = app.get(Logger)
logger.log(`NestJS server running on: ${serverUrl}`)
}
Comment thread
shikanime marked this conversation as resolved.

void bootstrap()
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export class ConfigurationService {
isDevSetup = process.env.DEV_SETUP === 'true'

// app
port = process.env.SERVER_PORT
host = process.env.SERVER_HOST ?? 'localhost'
port = process.env.SERVER_PORT ? Number(process.env.SERVER_PORT) : 0 // dynamically allocate an available ephemeral port
appVersion = this.isProd ? (process.env.APP_VERSION ?? 'unknown') : 'dev'

// db
Expand Down
Loading