Connect to Postgres via environment variables
-
Apparently Directus supports to connect to external existing Postgres databases via custom environment variables - I wanted to try it these days and was wondering if someone has tried it already.
Also, can I use the same to connect to the Postgres addon database which I'd use for my custom app?
Also, can anyone recommend a free online Postgres database I could use for testing? I only know ElephantSQL, but they have announced their end of life.
-
I could successfully connect to a test postgres database with these environment variables:
DB_HOST=IP
DB_PORT=Port
DB_DATABASE="db_name"
DB_USER="user_name"
DB_PASSWORD="password"Then I ran
npx directus bootstrap
to initialise the database.When I run commands like
npx directus count table_name
it provides correct answers indicating that the database connection works.However, for some reason, the database doesn't show up in my GUI.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login