Is there a way to enable an extension from CLI. I am working on moving our discourse community to Flarum and created a custom package to do migrations, SSO, etc.
What I have tried so far.
- I am able to install flarum from CLI using
php flarum install --file=config.yml
My YML file looks something like this
databaseConfiguration:
host: db
database: db
username: dbuser
password: dbpassword
baseUrl: https://community.mysecretorg.docker
adminUser:
username: admin
password: secret
email: admin@mysecretorg.docker
settings:
allow_sign_up: 0
extensions_enabled: '["mysecretorg-extend"]'
forum_title: Community
forum_description:
mail_driver: mail
mail_from: community@mysecretorg.docker
theme_colored_header: 0
theme_dark_mode: 0
theme_primary_color: '#4D698E'
theme_secondary_color: '#4D698E'
welcome_message: This is beta software and you should not use it in production.
welcome_title: Welcome to Flarum
On the Enabling bundled extensions step it overwrites the extensions_enabled
column of the settings
table.
The reason being my plugin is not part of the EXTENSION_WHITELIST
constant.
Since our vendor directory is not under source control I cannot modify the flarum code vendor file, which again is not advisable.
Other things I tried is to use a custom php file.
In this file I have the @include "vendor/autoload.php";
and thought somehow it will automatically load the flarum Service Containers and I can then resolve it via app('flarum.extensions)
but I don't think it works that way + I don't like the approach of creating a custom php file.
Other ideas involve registering a custom console command using extends.php
file but I am not sure if that is how it works.
The objective here is to install and configure Flarum using one shell script without having someone to go through click here, click there, configure this configure that.. This is important as we are going to be running Flarum on Kubernetes with horizontal scaling.
Any inputs as to how to achieve this are greatly appreciated.