50 lines
1.4 KiB
JavaScript
Executable File
50 lines
1.4 KiB
JavaScript
Executable File
// MongoDB initialization script for development environment
|
|
// This script runs when the MongoDB container starts for the first time
|
|
|
|
// Switch to the mozdit database
|
|
db = db.getSiblingDB('mozdit');
|
|
|
|
// Create collections with initial data
|
|
db.createCollection('site_config');
|
|
db.createCollection('contact_submissions');
|
|
db.createCollection('users');
|
|
|
|
// Insert initial site configuration
|
|
db.site_config.insertOne({
|
|
type: 'site_config',
|
|
environment: 'development',
|
|
data: {
|
|
general: {
|
|
name: 'mozdIT Bt.',
|
|
description: 'Professzionális webhosting, email szolgáltatás és DNS adminisztráció',
|
|
url: 'http://localhost:3000',
|
|
locale: 'hu-HU'
|
|
},
|
|
contact: {
|
|
email: 'info@mozdit.hu',
|
|
address: 'Budapest, Magyarország'
|
|
}
|
|
},
|
|
lastModified: new Date(),
|
|
createdAt: new Date()
|
|
});
|
|
|
|
// Create indexes for better performance
|
|
db.contact_submissions.createIndex({ "email": 1 });
|
|
db.contact_submissions.createIndex({ "timestamp": -1 });
|
|
db.site_config.createIndex({ "type": 1, "environment": 1 }, { unique: true });
|
|
|
|
// Create a development user (optional)
|
|
db.users.insertOne({
|
|
username: 'dev',
|
|
email: 'dev@mozdit.hu',
|
|
role: 'admin',
|
|
createdAt: new Date(),
|
|
isActive: true
|
|
});
|
|
|
|
print('MongoDB initialized successfully for development environment');
|
|
print('Database: mozdit');
|
|
print('Collections created: site_config, contact_submissions, users');
|
|
print('Initial data inserted');
|