Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Read database connection params from .env or environment #472

Gakai started this conversation in Ideas
Discussion options

Problem

Currently there is a need to specify "db.password" to get proper information about the database. But as postgrestools.jsonc is committed to the repository, it should not contain any secrets, even local ones.

I tried to find a solution, but couldn't find one that works for me.
Excluding the password and passing it via cli argument works in cli-only settings, but setting cli arguments is not supported by the VSCode extension, it seems.

Suggestion

Therefore I would like to suggest the ability to use .env or environment variables to set connection details. This allows a lot of flexibility for everyone.

Example

{
	// ...
	"db": {
		"host": "${POSTGRES_HOST}",
		"port": "${POSTGRES_PORT}",
		"username": "${POSTGRES_USERNAME}",
		"password": "${POSTGRES_PASSWORD}", // <-- prevents potential leak of passwords
		"database": "${POSTGRES_DATABASE}",
		// ...
	}
}
You must be logged in to vote

Replies: 2 comments 2 replies

Comment options

personally i'd love if more tools standardized on DATABASE_URL env var

You must be logged in to vote
2 replies
Comment options

That is also a possibility, but it's less flexible, I think.

Comment options

I don't believe it should be? it's just one fallback option when no explicit one is given
explicit config would be preferred over implicit fallbacks, but with some heuristics to try various env vars. for example bun supports a few env variables if no explicit config is given: POSTGRES_URL DATABASE_URL PGURL PG_URL TLS_POSTGRES_DATABASE_URL TLS_DATABASE_URL

Comment options

thanks for the feedback! We are tracking something similar in #302. adding this to the issue 👍🏼

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /