Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(postgres): add connectionURI option #143

Merged
merged 1 commit into from
Mar 12, 2024
Merged

Conversation

shivaraj-bh
Copy link
Member

resolves #141

@shivaraj-bh shivaraj-bh merged commit 8c25972 into main Mar 12, 2024
4 checks passed
@shivaraj-bh shivaraj-bh deleted the postgres-connection-uri branch March 12, 2024 08:54
Copy link
Member

@srid srid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new option can now be used here:

"postgres://$USER@${listen_addresses}:${builtins.toString port}/sample";

connectionURI = lib.mkOption {
type = lib.types.functionTo lib.types.str;
readOnly = true;
default = dbName: "postgres://${config.listen_addresses}:${builtins.toString config.port}/${dbName}";
Copy link
Member

@srid srid Mar 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can imagine being able to pass additional arguments in the future. So the arguments should probably be an attrset ({ dbName, ... }: ).

See https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING-URIS

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you go: #146

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

postgres: add an option exposing connection URI
2 participants