Closed bertday closed 2 years ago
I knew I forgot to add something to the readme.
When dirt starts it'll looks for a POSTGRES_CONNECTION
environmental variable. If it finds it it'll use that instead of whatever's in the connection string in config/index.json
. In index.js
it looks like this:
// postgres connection
fastify.register(require('fastify-postgres'), {
connectionString: process.env.POSTGRES_CONNECTION || config.db
})
I did that so I could stick the environmental variable for the db connection in a docker compose file and kinda forgot about it.
Hope that helps!
This is fantastic, thank you for the quick response @tobinbradley! I will try this out and close the issue for now 😄 Much appreciated.
As a quick followup, I tried setting the POSTGRES_CONNECTION
env var and got a little farther but then hit this error:
Error: Cannot find module './config'
So I think the question I meant to ask earlier was "is there a zero-config/click-to-deploy option". I could see that being helpful to some folks who just need to set the DB connection string and get off to the races—but also understand if that's not really a deployment goal...!
Hello, and a huge thank you for this project! It's already saved me a ton of time not having to write a back end.
I'm working on an app that needs to be hosted publicly and I'm looking at Render as a PaaS option. Render can take any GitHub repo and deploy it; so I could, for instance, point it to this repo and it will stand it up. I'm wondering what configuration would look like in that case. Is there any possibility of setting the DB connection string via environment variable, vs. writing the
config/index.json
file? Even if I forked this repo, I wouldn't want to commit my DB credentials to source control.Thanks so much for any guidance on this!