Skip to content

Commit f7331af

Browse files
authored
Merge pull request #8 from libkush/master
Deployment Ready
2 parents 2a2c90a + 9d21985 commit f7331af

29 files changed

+1500
-895
lines changed

.env.example

Lines changed: 151 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,164 @@
1-
# Database Configuration
1+
# =============================================================================
2+
# RECRUITMENT BACKEND - ENVIRONMENT CONFIGURATION
3+
# =============================================================================
4+
# Copy this file to .env and fill in the appropriate values for your environment
5+
# For production, consider using environment-specific files like .env.production
6+
7+
# =============================================================================
8+
# ENVIRONMENT SETTINGS
9+
# =============================================================================
10+
# Current environment: development, testing, production
11+
ENV=development
12+
13+
# =============================================================================
14+
# SERVER CONFIGURATION
15+
# =============================================================================
16+
# Port for the HTTP server to listen on
17+
PORT=8080
18+
19+
# =============================================================================
20+
# DATABASE CONFIGURATION
21+
# =============================================================================
22+
# PostgreSQL database connection settings
223
DB_HOST=localhost
324
DB_PORT=5432
425
DB_USER=postgres
5-
DB_PASSWORD=password
26+
DB_PASSWORD=your_secure_password_here
627
DB_NAME=recruitment_db
28+
29+
# Connection pool settings
30+
# Maximum number of open connections to the database
731
DB_MAX_CONNS=10
32+
# Minimum number of idle connections in the pool
833
DB_MIN_CONNS=2
934

10-
# Server Configuration
11-
PORT=8080
12-
GIN_MODE=debug
35+
# =============================================================================
36+
# SECURITY CONFIGURATION
37+
# =============================================================================
38+
# JWT Secret key - MUST be changed in production
39+
# Generate a secure random string of at least 32 characters
40+
# You can use: openssl rand -base64 32
41+
JWT_SECRET=your-super-secure-jwt-secret-key-change-in-production-minimum-32-chars
1342

14-
# JWT Configuration (Generate a secure secret using: make jwt-secret)
15-
JWT_SECRET=your-secret-key-change-in-production
43+
# JWT Token expiry duration (examples: 1h, 24h, 7d, 30d)
1644
JWT_EXPIRY_DURATION=24h
1745

18-
# Environment
19-
ENV=development
46+
# OTP Configuration
47+
# Email verification OTP duration (examples: 5m, 10m, 15m, 30m)
48+
EMAIL_VERIFICATION_OTP_DURATION=10m
49+
50+
# Password reset OTP duration (examples: 15m, 30m, 1h)
51+
PASSWORD_RESET_OTP_DURATION=30m
52+
53+
# =============================================================================
54+
# ADMIN USER CONFIGURATION
55+
# =============================================================================
56+
# Admin user auto-creation settings
57+
# If both ADMIN_EMAIL and ADMIN_PASSWORD are provided, an admin user will be created
58+
# automatically during server startup if it doesn't already exist
59+
60+
# Admin user email address
61+
ADMIN_EMAIL=[email protected]
62+
63+
# Admin user password (minimum 6 characters recommended)
64+
ADMIN_PASSWORD=secure_admin_password_123
65+
66+
# Optional: Admin user full name (defaults to "System Administrator")
67+
ADMIN_NAME='System Administrator'
68+
69+
# Optional: Admin user phone number (defaults to "0000000000")
70+
ADMIN_PHONE=+919876543210
71+
72+
# =============================================================================
73+
# NETWORK SECURITY CONFIGURATION
74+
# =============================================================================
75+
# Comma-separated list of trusted proxy IP addresses/ranges
76+
# Used by Gin to determine real client IP addresses behind proxies
77+
# Common private network ranges are included by default
78+
# Example: 127.0.0.1,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,your.proxy.ip
79+
TRUSTED_PROXIES=127.0.0.1,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
2080

21-
# SMTP Configuration
81+
# Comma-separated list of allowed CORS origins
82+
# For development: * allows all origins
83+
# For production: specify exact domains (https://yourfrontend.com,https://app.yourcompany.com)
84+
# SECURITY WARNING: Never use * in production!
85+
CORS_ALLOWED_ORIGINS=*
86+
87+
# =============================================================================
88+
# EMAIL CONFIGURATION
89+
# =============================================================================
90+
# SMTP server settings for sending emails
2291
SMTP_HOST=smtp.example.com
23-
24-
2592
SMTP_PORT=587
26-
SMTP_PASSWORD=smtp-password
27-
28-
# Development Notes:
29-
# - Copy this file to .env and update the values as needed
30-
# - Generate a secure JWT_SECRET using: make jwt-secret
31-
# - Change DB_PASSWORD to a secure password in production
32-
# - Set GIN_MODE to 'release' in production
33-
# - The default super admin credentials are:
34-
35-
# Password: password123
36-
# (Change these immediately in production!)
93+
SMTP_USER=your_smtp_username
94+
SMTP_PASSWORD=your_smtp_password
95+
96+
# OTP durations (examples: 5m, 10m, 15m, 30m)
97+
EMAIL_VERIFICATION_OTP_DURATION=10m
98+
PASSWORD_RESET_OTP_DURATION=30m
99+
100+
# From email address for outgoing emails
101+
102+
103+
# Email Templates Configuration
104+
# Use {{.OTP}}, {{.TOKEN}}, {{.DURATION}} as placeholders in email bodies
105+
# Email Verification Templates
106+
EMAIL_VERIFICATION_SUBJECT=Thank you for applying to IEEE Computer Society VITC. Please verify your email address
107+
EMAIL_VERIFICATION_BODY=Your OTP is: <strong>{{.OTP}}</strong>. It is valid for {{.DURATION}}.
108+
109+
# Resend Verification Templates
110+
EMAIL_RESEND_VERIFICATION_SUBJECT=IEEE Computer Society VITC - New Verification Code
111+
EMAIL_RESEND_VERIFICATION_BODY=Your new OTP is: <strong>{{.OTP}}</strong>. It is valid for {{.DURATION}}.
112+
113+
# Password Reset Templates
114+
EMAIL_PASSWORD_RESET_SUBJECT=IEEE Computer Society VITC - Password Reset Request
115+
EMAIL_PASSWORD_RESET_BODY=You have requested to reset your password. Your reset token is: <strong>{{.TOKEN}}</strong>. This token is valid for {{.DURATION}}. If you did not request this reset, please ignore this email.
116+
117+
# Password Reset Success Templates
118+
EMAIL_PASSWORD_RESET_SUCCESS_SUBJECT=IEEE Computer Society VITC - Password Reset Successful
119+
EMAIL_PASSWORD_RESET_SUCCESS_BODY=Your password has been successfully reset. If you did not perform this action, please contact support immediately.
120+
121+
# =============================================================================
122+
# BUSINESS LOGIC CONFIGURATION
123+
# =============================================================================
124+
# Comma-separated list of allowed email domains for registration
125+
# Example: company.com,university.edu
126+
ALLOWED_EMAIL_DOMAINS=vit.ac.in,vitstudent.ac.in
127+
128+
# Maximum number of applications a user can create
129+
MAXIMUM_APPLICATIONS_PER_USER=2
130+
131+
# =============================================================================
132+
# DEVELOPMENT/TESTING SPECIFIC SETTINGS
133+
# =============================================================================
134+
# These settings are typically only used in development/testing environments
135+
136+
# Set to true to enable additional debugging features
137+
# DEBUG=false
138+
139+
# Set to true to enable SQL query logging
140+
# DB_LOG_QUERIES=false
141+
142+
# =============================================================================
143+
# PRODUCTION NOTES
144+
# =============================================================================
145+
# For production deployment:
146+
# 1. Set ENV=production
147+
# 2. Generate a secure JWT_SECRET (minimum 32 characters)
148+
# 3. Use strong database passwords
149+
# 4. Configure proper SMTP settings
150+
# 5. Review and set appropriate ALLOWED_EMAIL_DOMAINS
151+
# 6. Consider using environment-specific files (.env.production)
152+
# 7. Never commit actual .env files to version control
153+
# 8. Use secrets management services for sensitive data in cloud deployments
154+
155+
# =============================================================================
156+
# EXAMPLE PRODUCTION VALUES
157+
# =============================================================================
158+
# ENV=production
159+
# PORT=8080
160+
# JWT_SECRET=super-secure-random-string-generated-with-openssl-rand-base64-32
161+
# DB_PASSWORD=very-secure-database-password
162+
# SMTP_HOST=smtp.yourmailprovider.com
163+
# SMTP_USER=apikey
164+
# SMTP_PASSWORD=your-api-key-or-password

.env.production.example

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# =============================================================================
2+
# PRODUCTION ENVIRONMENT CONFIGURATION
3+
# =============================================================================
4+
# This file is loaded when ENV=production
5+
# Copy to .env.production for your production environment
6+
#
7+
# SECURITY WARNING: Never commit production secrets to version control!
8+
# Use your deployment platform's secrets management instead.
9+
10+
ENV=production
11+
12+
# =============================================================================
13+
# SERVER - PRODUCTION
14+
# =============================================================================
15+
PORT=8080
16+
17+
# =============================================================================
18+
# DATABASE - PRODUCTION
19+
# =============================================================================
20+
# Use production database credentials
21+
DB_HOST=your-production-db-host
22+
DB_PORT=5432
23+
DB_USER=your-production-db-user
24+
DB_PASSWORD=your-very-secure-production-password
25+
DB_NAME=recruitment_db_production
26+
DB_MAX_CONNS=25
27+
DB_MIN_CONNS=5
28+
29+
# =============================================================================
30+
# SECURITY - PRODUCTION
31+
# =============================================================================
32+
# CRITICAL: Generate with: openssl rand -base64 32
33+
JWT_SECRET=REPLACE-WITH-SECURE-RANDOM-STRING-MINIMUM-32-CHARACTERS
34+
JWT_EXPIRY_DURATION=24h
35+
36+
# OTP Configuration
37+
EMAIL_VERIFICATION_OTP_DURATION=10m
38+
PASSWORD_RESET_OTP_DURATION=30m
39+
40+
# =============================================================================
41+
# ADMIN USER CONFIGURATION
42+
# =============================================================================
43+
# Admin user auto-creation settings
44+
# If both ADMIN_EMAIL and ADMIN_PASSWORD are provided, an admin user will be created
45+
# automatically during server startup if it doesn't already exist
46+
47+
# Admin user email address
48+
49+
50+
# Admin user password (minimum 6 characters recommended)
51+
ADMIN_PASSWORD=secure_admin_password_123
52+
53+
# Optional: Admin user full name (defaults to "System Administrator")
54+
ADMIN_NAME='System Administrator'
55+
56+
# Optional: Admin user phone number (defaults to "0000000000")
57+
ADMIN_PHONE=+919876543210
58+
59+
# =============================================================================
60+
# NETWORK SECURITY - PRODUCTION
61+
# =============================================================================
62+
# Trusted proxy IPs - configure based on your infrastructure
63+
# Examples: load balancer IPs, CDN ranges, reverse proxy IPs
64+
TRUSTED_PROXIES=your.loadbalancer.ip,your.proxy.ip
65+
66+
# CORS allowed origins - NEVER use * in production!
67+
# Specify exact frontend domains that should be allowed
68+
CORS_ALLOWED_ORIGINS=https://yourfrontend.com,https://app.yourcompany.com
69+
70+
# =============================================================================
71+
# EMAIL - PRODUCTION
72+
# =============================================================================
73+
SMTP_HOST=your-production-smtp-host
74+
SMTP_PORT=587
75+
SMTP_USER=your-production-smtp-user
76+
SMTP_PASSWORD=your-production-smtp-password
77+
78+
79+
# OTP durations (examples: 5m, 10m, 15m, 30m)
80+
EMAIL_VERIFICATION_OTP_DURATION=10m
81+
PASSWORD_RESET_OTP_DURATION=30m
82+
83+
# Email Templates - Production (customize for your organization)
84+
EMAIL_VERIFICATION_SUBJECT=Thank you for applying to IEEE Computer Society VITC. Please verify your email address
85+
EMAIL_VERIFICATION_BODY=Your OTP is: <strong>{{.OTP}}</strong>. It is valid for {{.DURATION}}.
86+
EMAIL_RESEND_VERIFICATION_SUBJECT=IEEE Computer Society VITC - New Verification Code
87+
EMAIL_RESEND_VERIFICATION_BODY=Your new OTP is: <strong>{{.OTP}}</strong>. It is valid for {{.DURATION}}.
88+
EMAIL_PASSWORD_RESET_SUBJECT=IEEE Computer Society VITC - Password Reset Request
89+
EMAIL_PASSWORD_RESET_BODY=You have requested to reset your password. Your reset token is: <strong>{{.TOKEN}}</strong>. This token is valid for {{.DURATION}}. If you did not request this reset, please ignore this email.
90+
EMAIL_PASSWORD_RESET_SUCCESS_SUBJECT=IEEE Computer Society VITC - Password Reset Successful
91+
EMAIL_PASSWORD_RESET_SUCCESS_BODY=Your password has been successfully reset. If you did not perform this action, please contact support immediately.
92+
93+
# =============================================================================
94+
# BUSINESS LOGIC - PRODUCTION
95+
# =============================================================================
96+
ALLOWED_EMAIL_DOMAINS=youruniversity.edu,yourcompany.com
97+
MAXIMUM_APPLICATIONS_PER_USER=2
98+
99+
# =============================================================================
100+
# PRODUCTION SECURITY CHECKLIST
101+
# =============================================================================
102+
# □ JWT_SECRET is at least 32 characters and randomly generated
103+
# □ DB_PASSWORD is strong and unique
104+
# □ SMTP credentials are valid and secure
105+
# □ ALLOWED_EMAIL_DOMAINS is properly configured
106+
# □ TRUSTED_PROXIES contains only your infrastructure IPs
107+
# □ CORS_ALLOWED_ORIGINS contains only your frontend domains (NO *)
108+
# □ All secrets are managed through your deployment platform
109+
# □ This file is not committed to version control

0 commit comments

Comments
 (0)