Is your feature request related to a problem? Please describe.
I am currently implementing a Docker based package for calibre-web (this is for Cloudron). calibre-web inits/migrates when run and continues to start the web server. The settings are loaded on start up. This means that if the package initializes settings after start up, those configs are not picked up. So, I have to start calibre-web, initialize settings in db, kill the server and start it up again.
Describe the solution you'd like
It will be helpful to have "cps.py init" or "cps.py migrate" which initializes and runs the database migrations.
Describe alternatives you've considered
All I can think of is to start it up, initialize and restart the web app.
Additional context
https://git.cloudron.io/cloudron/calibre-web-app/-/blob/master/start.sh#L62 is how I do it currently.
I am not a python programmer, so here's my basic analysis. We can implement subcommands in the cli.py like https://docs.python.org/dev/library/argparse.html#sub-commands . Two subcommands "start" and "migrate" should do it with "start" being the default for compatibility like right now.
A complete alternate solution is to reload the configuration when the server receives a signal or something. I don't know of many web servers that do this (many linux daemons do), so I am not sure if you like this idea. But something like this to nudge the web app to reload configuration is also OK (like some internal only route?).
Depending on your answer here, I would also like to have a "import_ldap_users" subcommand which can be invoked on startup or with some cronjob.
@OzzieIsaacs I don't know how easy/hard this is, but will you accept this change if I make a PR?
I need some time to think on it. I give you feedback this weekend
Most helpful comment
I need some time to think on it. I give you feedback this weekend