I just setup a new Nodejs app with a Postgres db. The launch was nice and took care of the environment variables for me, but now I need to access them so I can set the proper ENV variables on my app, as it uses DATABASE_NAME, DATABASE_PASSWORD and not the DATABASE_URL fly.io automatically setup. This is for strapi installation.
The app cannot load because it can’t connect to the database, so I cannot console in to echo the variables.
Is the solution to set the ENV vars myself on the building of the app? If so how I can do that? Thanks!
Thank you @ignoramous - as for the setting the environment variables I need to set them on the database server not on the regular server, and it seems like the 3 strategies laid out won’t let me set the database server’s ENV vars. Maybe the help I really need here is how to change my default flyctl project from the app I’m developing and onto the database server that fly generated for me.
Can you explain more about what you mean? What entrypoint file, if I’m not using docker, where would this ‘sleep’ be added onto? Sadly that link wasn’t very helpful there.
Good news! I found a way to get the ENV variables on the database!
Using fly pg dettach and then fly pg attach onto my database application it displays the DATABASE_URL that was auto generated (that my app doesn’t use).