- When a docker container restarts, all data is lost except volumes, secrets attached to it. So if I go via normal setup mode, the
config.php
file is created but it will be lost the moment container restarts. Hence, .env
serves the purpose.
- Also while setting up the staging environment, I faced SSL issue. I could not see the option for SSL config. (My colleague had setup the whole Flarum application on local, without docker, so she had it up and running, until we reached this stage where we needed a docker setup)
- luceos , I faced similar problem, So even I used that local dump on my staging environment. So yes, like you said, to mitigate the need for SQL dump, I am having a rough thought process:
- If the config file exists, then we move to the next step i.e. the DB migrations.
- Or we could remove the need for config file check and make it static committed to into the package; that would certainly mean a breaking change. The idea is inspired from Laravel
I also moved a few other things like debug, url, etc to .env
<?php
return [
'url' => env('APP_URL', ''),
'debug' => env('APP_DEBUG', false),
'database' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', 3306),
'database' => env('DB_DATABASE', 'flarum_db'),
'username' => env('DB_USERNAME', 'flarum_user'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => env('DB_PREFIX', ''),
'strict' => false,
'engine' => null,
'prefix_indexes' => true,
],
'paths' => [
'api' => 'api',
'admin' => 'admin',
],
'headers' => [
'poweredByHeader' => true,
'referrerPolicy' => 'same-origin',
],
'cookie' => [
'path' => '/',
'domain' => env('APP_DOMAIN', ''),
],
];