Is it possible to change the server config at runtime?

System Information
  • Strapi Version: 4.11.7

Is it possible to change the strapi config at runtime? For example, could I generate a custom global middleware that calls strapi.config.set('database', getHostBasedDatabase())? I tried changing the sqlite filepath on my local dev server that way. However, that did not have any effect.

Hi @tomschulze,

From the little I know I believe that changing any config at runtime on any nodejs, react, angular, etc project is not possible. Strapi is built on NodeJS therefore I think the answer is no.

If you change config and/or .env files on such projects you need to restart and rebuild, when rebuild is needed e.g. react, angular, starpi admin frontends etc.

I don’t know if there any workaround I can’t think of.

Hope I helped a bit.

Cheers :smiley: