Convert to template with dynamic configuration
Add comprehensive environment-based configuration system: - Created config.js module to centralize all environment variables - Updated server.js to use config module for all settings - Added /api/config endpoint to expose company info to frontend - Created init.js to dynamically inject config into HTML pages - Updated .env.example with comprehensive configuration options - Added data attributes to index.html for dynamic content - Updated Dockerfile to include config.js This allows users to customize: - Company name, tagline, and description - Branding colors (primary, accent, dark) - Contact information (email, phone, address, hours) - Social media links - About page content - Services offered 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
96
config.js
Normal file
96
config.js
Normal file
@@ -0,0 +1,96 @@
|
||||
// Configuration module for AI Recruitment Site Template
|
||||
// Centralizes all environment variable loading with sensible defaults
|
||||
|
||||
const crypto = require('crypto');
|
||||
|
||||
// Helper function to generate secure random strings
|
||||
function generateSecret(length = 64) {
|
||||
return crypto.randomBytes(length).toString('hex');
|
||||
}
|
||||
|
||||
// Company Information
|
||||
const company = {
|
||||
name: process.env.COMPANY_NAME || 'Your Recruitment Firm',
|
||||
tagline: process.env.COMPANY_TAGLINE || 'Finding the Perfect Match for Your Career',
|
||||
description: process.env.COMPANY_DESCRIPTION || 'We specialize in connecting talented professionals with exceptional opportunities across various industries.'
|
||||
};
|
||||
|
||||
// Branding Colors
|
||||
const branding = {
|
||||
primaryColor: process.env.PRIMARY_COLOR || '#2563EB',
|
||||
accentColor: process.env.ACCENT_COLOR || '#059669',
|
||||
darkColor: process.env.DARK_COLOR || '#1E293B'
|
||||
};
|
||||
|
||||
// Contact Information
|
||||
const contact = {
|
||||
email: process.env.CONTACT_EMAIL || 'info@yourcompany.com',
|
||||
phone: process.env.CONTACT_PHONE || '+1 (555) 123-4567',
|
||||
address: process.env.CONTACT_ADDRESS || '123 Business St, Suite 100, City, State 12345',
|
||||
businessHours: process.env.BUSINESS_HOURS || 'Monday - Friday: 9:00 AM - 6:00 PM'
|
||||
};
|
||||
|
||||
// Social Media Links
|
||||
const social = {
|
||||
linkedin: process.env.SOCIAL_LINKEDIN || '',
|
||||
twitter: process.env.SOCIAL_TWITTER || '',
|
||||
facebook: process.env.SOCIAL_FACEBOOK || ''
|
||||
};
|
||||
|
||||
// Application Settings
|
||||
const app = {
|
||||
nodeEnv: process.env.NODE_ENV || 'development',
|
||||
port: parseInt(process.env.PORT || '3000', 10),
|
||||
sessionSecret: process.env.SESSION_SECRET || generateSecret()
|
||||
};
|
||||
|
||||
// Database Configuration
|
||||
const database = {
|
||||
host: process.env.DB_HOST || 'localhost',
|
||||
port: parseInt(process.env.DB_PORT || '5432', 10),
|
||||
name: process.env.DB_NAME || 'recruitment',
|
||||
user: process.env.DB_USER || 'postgres',
|
||||
password: process.env.DB_PASSWORD || 'changeme123'
|
||||
};
|
||||
|
||||
// Feature Configuration
|
||||
const features = {
|
||||
maxCvSizeMB: parseInt(process.env.MAX_CV_SIZE_MB || '5', 10),
|
||||
allowedCvTypes: (process.env.ALLOWED_CV_TYPES || 'application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document').split(',')
|
||||
};
|
||||
|
||||
// About Page Content
|
||||
const about = {
|
||||
mission: process.env.ABOUT_MISSION || 'Our mission is to bridge the gap between exceptional talent and outstanding opportunities.',
|
||||
vision: process.env.ABOUT_VISION || 'We envision a world where every professional finds their perfect career match.',
|
||||
values: process.env.ABOUT_VALUES || 'Integrity, Excellence, Innovation, Partnership'
|
||||
};
|
||||
|
||||
// Services
|
||||
const services = {
|
||||
list: (process.env.SERVICES_LIST || 'Executive Search,Contract Staffing,Permanent Placement,Career Consulting,Talent Assessment,Industry Expertise').split(',')
|
||||
};
|
||||
|
||||
// Email Configuration
|
||||
const email = {
|
||||
smtpHost: process.env.SMTP_HOST || '',
|
||||
smtpPort: parseInt(process.env.SMTP_PORT || '587', 10),
|
||||
smtpUser: process.env.SMTP_USER || '',
|
||||
smtpPassword: process.env.SMTP_PASSWORD || '',
|
||||
smtpFrom: process.env.SMTP_FROM || 'noreply@yourcompany.com',
|
||||
contactFormRecipient: process.env.CONTACT_FORM_RECIPIENT || contact.email
|
||||
};
|
||||
|
||||
// Export configuration object
|
||||
module.exports = {
|
||||
company,
|
||||
branding,
|
||||
contact,
|
||||
social,
|
||||
app,
|
||||
database,
|
||||
features,
|
||||
about,
|
||||
services,
|
||||
email
|
||||
};
|
||||
Reference in New Issue
Block a user