feat(config): add configurable check-in date restriction and persistent logging
- Add ENABLE_CHECKIN_DATE_RESTRICTION environment variable to allow flexible check-in testing - Replace NODE_ENV check with configurable flag in check-in validation logic - Implement persistent logging with external Docker volumes (slc_logs_prod) - Configure backend-prod and nginx-prod to write logs to /var/log/app/ and /var/log/nginx-app/ - Increase log rotation limits (50MB, 10 files) for better debugging - Update .env.example files with new check-in configuration
This commit is contained in:
@@ -71,3 +71,8 @@ CLOUDFLARE_TURN_API_TOKEN=your-turn-api-token-here
|
||||
# Beta Testing
|
||||
# Auto-assign SUPPORTER tier to new registrations during beta
|
||||
BETA_AUTO_SUPPORTER=false
|
||||
|
||||
# Event Check-in
|
||||
# Enable date restriction for check-in (event dates ±1 day)
|
||||
# Set to 'false' for testing or events where QR code access is controlled manually
|
||||
ENABLE_CHECKIN_DATE_RESTRICTION=false
|
||||
|
||||
@@ -71,3 +71,8 @@ CLOUDFLARE_TURN_API_TOKEN=your-production-turn-api-token-here
|
||||
# Beta Testing
|
||||
# Auto-assign SUPPORTER tier to new registrations during beta
|
||||
BETA_AUTO_SUPPORTER=false
|
||||
|
||||
# Event Check-in
|
||||
# Enable date restriction for check-in (event dates ±1 day)
|
||||
# Set to 'false' for testing or events where QR code access is controlled manually
|
||||
ENABLE_CHECKIN_DATE_RESTRICTION=false
|
||||
|
||||
@@ -239,9 +239,9 @@ router.post('/checkin/:token', authenticate, async (req, res, next) => {
|
||||
|
||||
const event = checkinToken.event;
|
||||
|
||||
// Validate dates (only in production)
|
||||
const isProduction = process.env.NODE_ENV === 'production';
|
||||
if (isProduction) {
|
||||
// Validate dates (only if date restriction is enabled)
|
||||
const enableDateRestriction = process.env.ENABLE_CHECKIN_DATE_RESTRICTION === 'true';
|
||||
if (enableDateRestriction) {
|
||||
const now = new Date();
|
||||
const validFrom = new Date(event.startDate);
|
||||
validFrom.setDate(validFrom.getDate() - 1);
|
||||
|
||||
@@ -34,15 +34,17 @@ services:
|
||||
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
- ./nginx/conf.d.prod:/etc/nginx/conf.d:ro
|
||||
- ./ssl:/etc/nginx/ssl:ro
|
||||
- app_logs_prod:/var/log/nginx-app
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
restart: always
|
||||
command: ["/bin/sh", "-c", "nginx -g 'daemon off;' 2>&1 | tee -a /var/log/nginx-app/nginx.log"]
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
max-size: "50m"
|
||||
max-file: "10"
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
@@ -175,13 +177,15 @@ services:
|
||||
- LOG_LEVEL=warn
|
||||
depends_on:
|
||||
- db-prod
|
||||
command: ["node", "src/server.js"]
|
||||
command: ["sh", "-c", "node src/server.js 2>&1 | tee -a /var/log/app/backend.log"]
|
||||
restart: always
|
||||
volumes:
|
||||
- app_logs_prod:/var/log/app
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
max-size: "50m"
|
||||
max-file: "10"
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
@@ -248,6 +252,9 @@ volumes:
|
||||
postgres_data_prod:
|
||||
external: true
|
||||
name: slc_postgres_prod_data
|
||||
app_logs_prod:
|
||||
external: true
|
||||
name: slc_logs_prod
|
||||
|
||||
networks:
|
||||
slc_network:
|
||||
|
||||
Reference in New Issue
Block a user