59 lines
2.0 KiB
PHP
59 lines
2.0 KiB
PHP
<?php
|
|
function get_env($key, $default = null) {
|
|
$value = getenv($key);
|
|
if ($value === false) {
|
|
return $default;
|
|
}
|
|
return $value;
|
|
}
|
|
|
|
$config = array();
|
|
|
|
# Debugging
|
|
if (get_env('DEBUG')) {
|
|
$config['debug'] = $_ENV['DEBUG'];
|
|
}
|
|
|
|
# Database connection
|
|
$config['databaseConfiguration'] = array(
|
|
'driver' => 'mysql',
|
|
'host' => get_env('MYSQL_HOST', 'mysql'),
|
|
'port' => get_env('MYSQL_PORT', 3306),
|
|
'database' => get_env('MYSQL_DATABASE', 'flarum'),
|
|
'username' => get_env('MYSQL_USER', 'flarum'),
|
|
'password' => get_env('MYSQL_PASSWORD', 'flarum'),
|
|
);
|
|
|
|
# Site URL
|
|
$config['baseUrl'] = get_env('SITE_URL', 'http://localhost');
|
|
|
|
# Admin user
|
|
if (get_env('ADMIN_PASSWORD')) {
|
|
$config['adminUser'] = array(
|
|
'username' => get_env('ADMIN_USER', 'admin'),
|
|
'password' => get_env('ADMIN_PASSWORD', 'password'),
|
|
'email' => get_env('ADMIN_EMAIL', 'admin@example.com'),
|
|
);
|
|
}
|
|
|
|
# Other settings
|
|
$config['settings'] = array(
|
|
'forum_title' => get_env('FORUM_TITLE', 'A new Flarum forum'),
|
|
'forum_description' => get_env('FORUM_DESCRIPTION', ''),
|
|
'mail_driver' => get_env('MAIL_DRIVER', 'mail'),
|
|
'mail_from' => get_env('MAIL_FROM', 'noreply@localhost'),
|
|
'mail_host' => get_env('MAIL_HOST', 'localhost'),
|
|
'mail_port' => get_env('MAIL_PORT', '25'),
|
|
'mail_encryption' => get_env('MAIL_ENCRYPTION', ''), // "tls" or "ssl"
|
|
'mail_username' => get_env('MAIL_USERNAME'), // required
|
|
'mail_password' => get_env('MAIL_PASSWORD'), // required
|
|
'theme_colored_header' => get_env('THEME_COLORED_HEADER', '0'),
|
|
'theme_dark_mode' => get_env('THEME_DARK_MODE', '0'),
|
|
'theme_primary_color' => get_env('THEME_PRIMARY_COLOR', '#4D698E'),
|
|
'theme_secondary_color' => get_env('THEME_SECONDARY_COLOR', '#4D698E'),
|
|
'welcome_message' => get_env('WELCOME_MESSAGE', 'Enjoy your new forum! Hop over to discuss.flarum.org if you have any questions, or to join our community!'),
|
|
'welcome_title' => get_env('WELCOME_TITLE', 'Welcome to Flarum'),
|
|
);
|
|
|
|
yaml_emit_file('./config.yaml', $config);
|