I have a rails app with a managed development database and I am trying to add a job to migrate my rails app before each deploy.
I set the environment variable DATABASE_URL
with a value of ${db.DATABASE_URL}
.
But it seems like the connection parameters are not being passed and instead is passing a string directly which causes this error.
URI::InvalidURIError: bad URI(is not URI?): ${db.DATABASE_URL}
How can I pass the database connection parameters correctly in a job?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hi there Drew,
Is the name of your database
db
? The syntax is the following:If you’ve named your database differently, you need to change the
db
part accordingly to match your database name.Let me know how it goes:
Best,
Bobby
Hi @DrewTerry
Try to define your
DATABASE_URL
as follows:Then you must create the environment variable in
.bashrc
file:Puts your
DATABASE_URL
variable at the end of the file:Finally, saves file and execute the content of the file:
Hope helps you,
Sergio Turpín
Want to learn more? Join the DigitalOcean Community!
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Sign up now