Open Xexnon opened 3 years ago
common man. You couldn't have read the docs.
example: "user": {"ENV": "PRODUCTION_USERNAME"},
Nowhere in the docs does it say you can use ENV
as a key in the json. It's a VALUE wrapped in {}
Nowhere in the docs does it say you can set defaultEnv
to a Node
Environment variable. You set it to a specific dbmigrate environment (e.g. test
, development
, etc.)
I think "defaultEnv": { "ENV": "NODE_ENV" }
should work, but other than that, @dschinkel is correct. You should use the idiom { "ENV": "ENV_VAR_NAME" }
to reference an environment variable ENV_VAR_NAME
at runtime.
You cannot replace DATABASE_URL
everywhere (because I'm not sure every driver even have a single URL configuration property you can set), but you can replace some of the properties expected by each driver with an env-var configuration, e.g.:
{
"development": {
"driver": "mysql",
"multipleStatements": true,
"username": { "ENV": "DATABASE_USERNAME" },
"password": { "ENV": "DATABASE_PASSWORD" } // etc, etc.
},
"defaultEnv": { "ENV": "NODE_ENV" }, // Just be sure that NODE_ENV has the correct driver name, e.g. development, production, etc
"sql-file": true
}
please read the docs: https://db-migrate.readthedocs.io/en/latest/Getting%20Started/configuration/
Originally posted by @wzrdtales in https://github.com/db-migrate/node-db-migrate/issues/749#issuecomment-920919061
I followed the docs and this is my config file I'm using a database url