This enables us to fetch variables and update them in before the server starts. However this doesn’t work with database.js. Is database process run before bootstrap.js?
You might be able to find a node package to pull from vault but can’t say I ever tried. Since I trust my infrastructure, the variables are written to a secured .env file when I use Ansible to deploy the application.
If you do find a working option though I would love to see it, massive fan of Hashicorp Consul and Vault
Hey @DMehaffy So the issue is not pulling env from vault. the actual issue is making the database.js use adapted env variables. Is there anyway we can make database.js to start after a promise has been resolved?
Most likely not in this case, you would likely need to use the bootstrap function to set the variables at the initial boot as before the application starts there is migration level that happens that checks the database.
I would have to do some testing, you might be able to perform some logic outside the exports object of the database.js file however I’m not sure if that will throw errors on boot since I believe it’s designed to pull from environment variables.
The alternative would be to have a custom start script that pulls the environment variables and sets them before Strapi even starts like a typical node server.js file