From ac21e428a5ed29126fca4187828149d16a9b1382 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikael=20West=C3=B6=C3=B6?= Date: Fri, 23 Jan 2026 23:26:57 +0100 Subject: [PATCH] Convert to template with dynamic configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .env.example | 110 ++++++++++++++++++++++++++++++++++--- Dockerfile | 1 + config.js | 96 +++++++++++++++++++++++++++++++++ public/index.html | 19 +++---- public/js/init.js | 135 ++++++++++++++++++++++++++++++++++++++++++++++ server.js | 42 +++++++++------ 6 files changed, 370 insertions(+), 33 deletions(-) create mode 100644 config.js create mode 100644 public/js/init.js diff --git a/.env.example b/.env.example index 11628de..2180e67 100644 --- a/.env.example +++ b/.env.example @@ -1,16 +1,110 @@ +# =================================== +# AI Recruitment Site - Configuration +# =================================== +# Copy this file to .env and customize for your company + +# =================================== +# Company Information +# =================================== +COMPANY_NAME=Your Recruitment Firm +COMPANY_TAGLINE=Finding the Perfect Match for Your Career +COMPANY_DESCRIPTION=We specialize in connecting talented professionals with exceptional opportunities across various industries. + +# =================================== +# Company Branding (Colors) +# =================================== +# Primary brand color (e.g., #2563EB for blue) +PRIMARY_COLOR=#2563EB +# Accent/success color (e.g., #059669 for green) +ACCENT_COLOR=#059669 +# Dark/secondary color (e.g., #1E293B) +DARK_COLOR=#1E293B + +# =================================== +# Contact Information +# =================================== +CONTACT_EMAIL=info@yourcompany.com +CONTACT_PHONE=+1 (555) 123-4567 +CONTACT_ADDRESS=123 Business St, Suite 100, City, State 12345 + +# Social Media Links (leave empty to hide) +SOCIAL_LINKEDIN=https://linkedin.com/company/yourcompany +SOCIAL_TWITTER=https://twitter.com/yourcompany +SOCIAL_FACEBOOK= + +# =================================== +# Deployment Configuration +# =================================== +# Your custom subdomain (e.g., 'yourname' becomes yourname.recruitai.startanaicompany.com) +SUBDOMAIN=yourname + +# Your Gitea username and repository name +GITEA_USERNAME=your-gitea-username +GITEA_REPO_NAME=ai-recruit-site-template + +# =================================== +# Application Settings +# =================================== +NODE_ENV=production +PORT=3000 + +# Session secret (will be auto-generated if empty) +SESSION_SECRET= + +# =================================== # Database Configuration +# =================================== +# PostgreSQL connection details DB_HOST=postgres DB_PORT=5432 DB_NAME=recruitment DB_USER=postgres -DB_PASSWORD=changeme123 +# Database password (will be auto-generated if empty) +DB_PASSWORD= -# Application Configuration -PORT=3000 -NODE_ENV=production +# =================================== +# API Tokens (for deployment script) +# =================================== +# These should be set as environment variables, NOT in this file +# COOLIFY_API_TOKEN=your-coolify-api-token +# GITEA_API_TOKEN=your-gitea-api-token -# Session Secret (CHANGE THIS IN PRODUCTION!) -SESSION_SECRET=your-very-secret-session-key-change-this-in-production +# =================================== +# Feature Configuration +# =================================== +# Maximum CV file size in MB +MAX_CV_SIZE_MB=5 -# Optional: Application URL -APP_URL=http://localhost:3000 +# Allowed CV file types (comma-separated) +ALLOWED_CV_TYPES=application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document + +# =================================== +# About Page Content +# =================================== +ABOUT_MISSION=Our mission is to bridge the gap between exceptional talent and outstanding opportunities. +ABOUT_VISION=We envision a world where every professional finds their perfect career match. +ABOUT_VALUES=Integrity, Excellence, Innovation, Partnership + +# =================================== +# Services Offered (comma-separated) +# =================================== +SERVICES_LIST=Executive Search,Contract Staffing,Permanent Placement,Career Consulting,Talent Assessment,Industry Expertise + +# =================================== +# Contact Page Settings +# =================================== +# Email address where contact form submissions are sent +CONTACT_FORM_RECIPIENT=info@yourcompany.com + +# Business hours +BUSINESS_HOURS=Monday - Friday: 9:00 AM - 6:00 PM + +# =================================== +# Email Configuration (Optional) +# =================================== +# If you want to send email notifications +SMTP_HOST= +SMTP_PORT=587 +SMTP_USER= +SMTP_PASSWORD= +SMTP_FROM=noreply@yourcompany.com diff --git a/Dockerfile b/Dockerfile index 03bc3a1..4475052 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,6 +10,7 @@ RUN npm install --production # Copy application code COPY server.js ./ +COPY config.js ./ COPY migrations ./migrations # Copy public directory explicitly diff --git a/config.js b/config.js new file mode 100644 index 0000000..9224b89 --- /dev/null +++ b/config.js @@ -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 +}; diff --git a/public/index.html b/public/index.html index 82f25d1..0694d01 100644 --- a/public/index.html +++ b/public/index.html @@ -5,11 +5,12 @@ Ryans Recruit Firm - Find Your Dream Job +