I’ve been using Adonis (Adonuxt template) for a while but I just came across a fairly unusual use case and I could really use some insight.
I am trying to set up a multi tenant app where each subdomain gets it’s own specific ENV (loaded first from the .env file then overridden by the values loaded from a DB), so that:
- subA.domain.com => database: A, Env to be loaded from database A, table “Env”
- subB.domain.com => database: B, Env to be loaded from database B, table “Env”
I kind of have an idea on how to change the database connection base on the environment, but where would the best place be to place the script that overrides the env reading it from a database?
I know this is Nuxt specific, but that would need to apply for the Env loaded on nuxt.js.