[GH-ISSUE #5976] Activity and auth datastore DSN are not configurable via environment variables #11978

Open
opened 2026-08-05 01:31:58 -04:00 by saavagebueno · 1 comment
Owner

Originally created by @kpalang on GitHub (Apr 23, 2026).
Original GitHub issue: https://github.com/netbirdio/netbird/issues/5976

Describe the problem

The activity and auth datastore DSN are not configurable via environment variables when engine type is not sqlite. The main database is well configurable via NB_STORE_ENGINE_POSTGRES_DSN, but a missing server.activityStore.dsn throws an error.

The env var is technically read here during store creation, but before that is read, the initializeConfig() errors out here if the key is not set in the config.yaml file.

To Reproduce

Steps to reproduce the behavior:

  1. Set server.activityStore.engine to postgres in config.yaml
  2. Ensure server.activityStore.dsn is not set in config.yaml
  3. Observe activityStore.dsn is required when activityStore.engine is postgres in server logs

Expected behavior

Expected behavior should be to allow NetBird to read activity and auth store DSNs from environment.

Are you using NetBird Cloud?

Self-hosted

NetBird version

Current main at 13539543af0f0d5313afedbbe00a6037ed087637

Is any other VPN software installed?

Irrelevant

Debug output

Irrelevant

Screenshots

Irrelevant

Additional context

The lack of the described capability greatly diminishes the value of running the main store in postgres. K8s-like deployments become less feasible, too as the system is still largely dependent on disk storage.

Have you tried these troubleshooting steps?

  • Reviewed client troubleshooting (if applicable)
  • Checked for newer NetBird versions
  • Searched for similar issues on GitHub (including closed ones)
  • Restarted the NetBird client
  • Disabled other VPN software
  • Checked firewall settings
Originally created by @kpalang on GitHub (Apr 23, 2026). Original GitHub issue: https://github.com/netbirdio/netbird/issues/5976 **Describe the problem** The activity and auth datastore DSN are not configurable via environment variables when engine type is not `sqlite`. The main database is well configurable via `NB_STORE_ENGINE_POSTGRES_DSN`, but a missing `server.activityStore.dsn` throws an error. The env var is _technically_ read [here](https://github.com/netbirdio/netbird/blob/403babd433cbf7feaee21be3cc4746cb12e887c2/management/server/activity/store/sql_store.go#L262) during store creation, but before that is read, the `initializeConfig()` [errors out here](https://github.com/netbirdio/netbird/blob/96806bf55fb9c5fabe7390a69744a69e68e495b7/combined/cmd/root.go#L150-L152) if the key is not set in the config.yaml file. **To Reproduce** Steps to reproduce the behavior: 1. Set `server.activityStore.engine` to `postgres` in `config.yaml` 2. Ensure `server.activityStore.dsn` is not set in `config.yaml` 3. Observe `activityStore.dsn is required when activityStore.engine is postgres` in server logs **Expected behavior** Expected behavior should be to allow NetBird to read activity and auth store DSNs from environment. **Are you using NetBird Cloud?** Self-hosted **NetBird version** Current `main` at `13539543af0f0d5313afedbbe00a6037ed087637` **Is any other VPN software installed?** _Irrelevant_ **Debug output** _Irrelevant_ **Screenshots** _Irrelevant_ **Additional context** The lack of the described capability greatly diminishes the value of running the main store in postgres. K8s-like deployments become less feasible, too as the system is still largely dependent on disk storage. **Have you tried these troubleshooting steps?** - [ ] Reviewed [client troubleshooting](https://docs.netbird.io/how-to/troubleshooting-client) (if applicable) - [x] Checked for newer NetBird versions - [x] Searched for similar issues on GitHub (including closed ones) - [ ] Restarted the NetBird client - [ ] Disabled other VPN software - [ ] Checked firewall settings
saavagebueno added the triage-needed label 2026-08-05 01:31:58 -04:00
Author
Owner

@kpalang commented on GitHub (Apr 23, 2026):

I'd like to comment that the workaround of setting the activity store engine not from the config.yaml but using the NB_ACTIVITY_EVENT_STORE_ENGINE should not be considered valid unless it is explicitly and loudly specified in the documentation that setting the key in yaml will break the setup.

<!-- gh-comment-id:4309541478 --> @kpalang commented on GitHub (Apr 23, 2026): I'd like to comment that the workaround of setting the activity store engine not from the `config.yaml` but using the `NB_ACTIVITY_EVENT_STORE_ENGINE` should not be considered valid unless it is explicitly and loudly specified in the documentation that setting the key in yaml will break the setup.
Sign in to join this conversation.
No Label triage-needed
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#11978