There are two potential improvements with the chage-db.js script that comes with the templates
move it to scripts folder, and
more importantly, inject env variables
The script uses process.env.NETWORK ?? 'localhost' but since env variables are never injected into the file (with dotenv for example) this will only ever work with localhost, which should be fine for most cases, but not all of them (if using a proxy for example).
I suggest that we simply inject the env variables from ../.env.localhost (or ../.env.{environment} if it's expected to work in a non-development setting).
There are two potential improvements with the chage-db.js script that comes with the templates
The script uses
process.env.NETWORK ?? 'localhost'
but sinceenv
variables are never injected into the file (with dotenv for example) this will only ever work withlocalhost
, which should be fine for most cases, but not all of them (if using a proxy for example).I suggest that we simply inject the env variables from
../.env.localhost
(or../.env.{environment}
if it's expected to work in a non-development setting).ie: