Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Provide Postgresql database settings not only via connection string #15264

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

Closed
MrPeacockNLB opened this issue Oct 29, 2024 · 4 comments
Closed
Labels
customer-requested Features requested by enterprise customers. Only humans may set this. good first issue Easily solved issues suitable for starters and community contributors need-backend Issues that need backend work

Comments

@MrPeacockNLB
Copy link
Contributor

MrPeacockNLB commented Oct 29, 2024

Description

I've search Coder help with coder server -h and found only one environment variable CODER_PG_CONNECTION_URL to setup connection settings. As we are using automatic password rotation this is a point of failure as we have to assemble a secret for coder Postgresql connection URL. Now this secret has changed and I've to change the connection URL, but it would be better if one can pass the rotated secret for the password as a separate environment variable.

Solution

Provide additional way of configuration for Postgresql connection settings like this:

  • CODER_PG_HOST
  • CODER_PG_PORT ==> defaults to 5432
  • CODER_PG_USERNAME
  • CODER_PG_PASSWORD
  • CODER_PG_DATABASE
  • CODER_PG_OPTIONS

We can make use of External Secrets Operator to provide the automatically rotated password. Then if a password change has happend a sync of the secret should find it's way into Coder instance.

E.g.:

CODER_PG_OPTIONS="sslmode=require"

postgres://$CODER_PG_USER:$CODER_PG_PASSWORD@$CODER_PG_HOST:$CODER_PG_PORT/$CODER_PG_DATABASE?$CODER_PG_OPTIONS

@coder-labeler coder-labeler bot added customer-requested Features requested by enterprise customers. Only humans may set this. need-backend Issues that need backend work labels Oct 29, 2024
@bpmct bpmct added the good first issue Easily solved issues suitable for starters and community contributors label Oct 29, 2024
@matifali
Copy link
Member

Thank you for the suggestion @MrPeacockNLB. We can do it, of course.

@joobisb
Copy link
Contributor

joobisb commented Nov 5, 2024

@matifali @bpmct I've raised a PR for this, please have a look

@spikecurtis
Copy link
Contributor

@MrPeacockNLB could you pass the password into an environment variable and then have shell interpolate the PostgreSQL URL?

env:
  - name: MY_PASSWORD
    valueFrom: ...
  ...
cmd: ["/bin/sh"]
args: ["-c", "coder server --postgres-url=postgres://coder:[email protected]/coder?sslmode=require"]

kylecarbs pushed a commit that referenced this issue Mar 13, 2025
Fix bug that prevented individual PostgreSQL connection parameters from being
shown in CLI help output and being used properly. The parameters were already
defined in the DeploymentValues struct but weren't accessible due to a type
mismatch when checking InMemoryDatabase value.

This allows users to specify PostgreSQL connection details using individual
environment variables, which is useful for systems with automatic password
rotation.

Closes #15264

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
kylecarbs pushed a commit that referenced this issue Mar 13, 2025
Added tests to verify the PostgreSQL URL construction from individual components
and the CLI flags/environment variables handling:

1. Added unit test in cli/clitest package to test URL construction
2. Added integration test in cli/server_test.go to test CLI flags
3. Added integration test for environment variables

Refs #15264
kylecarbs pushed a commit that referenced this issue Mar 18, 2025
Implements feature request from issue #15264 to add a "Mark all as read" feature for notifications. This PR adds:
1. A new SQL query to mark all unread notifications as read for a user
2. A new REST API endpoint at /api/v2/notifications/inbox/mark-all-read
3. A new SDK method MarkAllInboxNotificationsRead
4. A comprehensive test to verify the functionality

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@matifali
Copy link
Member

matifali commented May 7, 2025

Not planned as discussed in #15379

@matifali matifali closed this as not planned Won't fix, can't repro, duplicate, stale May 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-requested Features requested by enterprise customers. Only humans may set this. good first issue Easily solved issues suitable for starters and community contributors need-backend Issues that need backend work
Projects
None yet
5 participants