-
-
Notifications
You must be signed in to change notification settings - Fork 359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If database.json includes {"ENV": "DATABASE_URL"} then migrations require the environment variable to contain a valid value #391
Comments
Hey @erezny, essentially, your first problem is that you seem to have the database.json commited in your repository. This is something you should never want to do for any config files. In fact, db-migrate allows configuring it via the So what you did defined here, does actually have no effect at all:
Take a look here: https://github.com/db-migrate/node-db-migrate/blob/master/api.js#L550-L551 You can see that
So you see, that the heroku use case is also already built in and all you need is a valid database uri. Also read https://devcenter.heroku.com/articles/heroku-postgresql#create-a-new-database for reference. |
If you have any other questions, please feel free to reach out. |
Btw. another addition, just from years of experience, you should work in development on the same environment like in production if you don't want any bad surprises. |
Right, OK. |
I think this should still be fixed. Other env variables names can be used.
The only thing that causes this error is that my MONGO_URL env variable is not set in development, and I don't see any reason why that shouldn't be possible. |
@fklingler Ok, but you talk about a completely different thing now. Maybe you could open a new issue on this and describe more your problem and give a way to reproduce your problem? Currently I don't really know where your problem is though, I would need a bit more details though. |
I still think this is the same exact problem. On my production environment, I set the database URL using an environment variable, in this case, MONGO_URL. On this development environment, I don't have the MONGO_URL env variable set. This is what causes the problem. Is this more clear? |
@fklingler It is, as said, those are two complete different things. They're actually handled different.
|
This is exactly the same problem, but the solution is just simpler if the environment variable in question is I will also go now, I'll be back in a few hours or tomorrow. Thanks for your quick answers! |
@fklingler Ok, back a bit earlier than thought. So yes and no. While you're right the problem is kind of the same and that the behavior you describe is not wanted, those still are two different problem. The thing is that you don't need and should not define the |
I defined a dev environment that uses sqlite3 and defined staging and prod environment which use heroku postgres. When I run a migration in the dev environment node-db-migrate complains about the environment variables in staging and prod. I do not want to include the flat values in my database.json because I do not want these secret values in my code base.
database.json:
The text was updated successfully, but these errors were encountered: