Implemented Settings
Improved cronjob Fixed Views Added env encryption key for encrypting sensitive data in database.
This commit is contained in:
@@ -10,6 +10,16 @@ $dotenv = Dotenv::createImmutable(__DIR__ . '/..');
|
||||
$dotenv->load();
|
||||
|
||||
try {
|
||||
// Check if encryption key is set
|
||||
if (empty($_ENV['APP_ENCRYPTION_KEY'])) {
|
||||
echo "⚠️ WARNING: APP_ENCRYPTION_KEY is not set in .env\n";
|
||||
echo " This key is required to encrypt sensitive data (like SMTP passwords).\n\n";
|
||||
echo " Generate one using:\n";
|
||||
echo " php scripts/generate-encryption-key.php\n\n";
|
||||
echo " Then add it to your .env file and run migrations again.\n\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$host = $_ENV['DB_HOST'];
|
||||
$port = $_ENV['DB_PORT'];
|
||||
$database = $_ENV['DB_DATABASE'];
|
||||
@@ -36,6 +46,7 @@ try {
|
||||
__DIR__ . '/migrations/004_create_tld_registry_table.sql',
|
||||
__DIR__ . '/migrations/005_update_tld_import_logs.sql',
|
||||
__DIR__ . '/migrations/006_add_complete_workflow_import_type.sql',
|
||||
__DIR__ . '/migrations/007_add_app_and_email_settings.sql',
|
||||
];
|
||||
|
||||
foreach ($migrationFiles as $migrationFile) {
|
||||
|
||||
@@ -28,7 +28,7 @@ CREATE TABLE IF NOT EXISTS domains (
|
||||
registrar VARCHAR(255),
|
||||
expiration_date DATE,
|
||||
last_checked TIMESTAMP NULL,
|
||||
status ENUM('active', 'expiring_soon', 'expired', 'error') DEFAULT 'active',
|
||||
status ENUM('active', 'expiring_soon', 'expired', 'error', 'available') DEFAULT 'active',
|
||||
whois_data JSON,
|
||||
is_active BOOLEAN DEFAULT TRUE,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
17
database/migrations/007_add_app_and_email_settings.sql
Normal file
17
database/migrations/007_add_app_and_email_settings.sql
Normal file
@@ -0,0 +1,17 @@
|
||||
-- Add application and email settings to database
|
||||
INSERT INTO settings (setting_key, setting_value) VALUES
|
||||
-- Application Settings
|
||||
('app_name', 'Domain Monitor'),
|
||||
('app_url', 'http://localhost:8000'),
|
||||
('app_timezone', 'UTC'),
|
||||
|
||||
-- Email Settings
|
||||
('mail_host', 'smtp.mailtrap.io'),
|
||||
('mail_port', '2525'),
|
||||
('mail_username', ''),
|
||||
('mail_password', ''),
|
||||
('mail_encryption', 'tls'),
|
||||
('mail_from_address', 'noreply@domainmonitor.com'),
|
||||
('mail_from_name', 'Domain Monitor')
|
||||
ON DUPLICATE KEY UPDATE setting_key=setting_key;
|
||||
|
||||
Reference in New Issue
Block a user