[Feature] allow environment variables in config file also in postgresql config #741

Closed
opened 2025-12-29 02:23:07 +01:00 by adam · 4 comments
Owner

Originally created by @ibotty on GitHub (Jul 8, 2024).

Use case

I'd like to get the postgresql configuration from the environment where I can configure it more flexible (in Kubernetes).

Description

I searched quiet some time on why the ${..} syntax did not work until I found that the oidc.client_secret_path is handled explicitly.

Contribution

  • I can write the design doc for this feature
  • I can contribute this feature

How can it be implemented?

I would propose that any ${..} in the config file should be interpolated.

Originally created by @ibotty on GitHub (Jul 8, 2024). ### Use case I'd like to get the postgresql configuration from the environment where I can configure it more flexible (in Kubernetes). ### Description I searched quiet some time on why the `${..}` syntax did not work until I found that the `oidc.client_secret_path` is handled explicitly. ### Contribution - [X] I can write the design doc for this feature - [x] I can contribute this feature ### How can it be implemented? I would propose that any `${..}` in the config file should be interpolated.
adam added the enhancement label 2025-12-29 02:23:07 +01:00
adam closed this issue 2025-12-29 02:23:07 +01:00
Author
Owner

@ibotty commented on GitHub (Jul 8, 2024):

I might be able to contribute, but I don't program in Go often so would need guidance.

@ibotty commented on GitHub (Jul 8, 2024): I might be able to contribute, but I don't program in Go often so would need guidance.
Author
Owner

@kradalby commented on GitHub (Jul 11, 2024):

Hi, all configuration can already be done from the environment:

database:
  type: postgres
  postgres:
    host: localhost

Can be set with:

HEADSCALE_DATABASE_TYPE: postgres
HEADSCALE_DATABASE_POSTGRES_HOST: localhost

We do this in the integration tests: https://github.com/juanfont/headscale/blob/main/integration/hsic/config.go#L113

@kradalby commented on GitHub (Jul 11, 2024): Hi, all configuration can already be done from the environment: ```yaml database: type: postgres postgres: host: localhost ``` Can be set with: ``` HEADSCALE_DATABASE_TYPE: postgres HEADSCALE_DATABASE_POSTGRES_HOST: localhost ``` We do this in the integration tests: https://github.com/juanfont/headscale/blob/main/integration/hsic/config.go#L113
Author
Owner

@ibotty commented on GitHub (Jul 11, 2024):

Oh, great. I did not find any documentation. I can try to formulate something. Where should it be?

@ibotty commented on GitHub (Jul 11, 2024): Oh, great. I did not find any documentation. I can try to formulate something. Where should it be?
Author
Owner

@kradalby commented on GitHub (Jul 11, 2024):

That would be awesome!

I dont see a place where it would fit right now, so maybe a separate page under docs/ with notes about the config would make sense.

What do you think @ohdearaugustin?

@kradalby commented on GitHub (Jul 11, 2024): That would be awesome! I dont see a place where it would fit right now, so maybe a separate page under `docs/` with notes about the config would make sense. What do you think @ohdearaugustin?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#741