-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Problem
Currently we can specify multiple hosts for the postgres backend like this:
AUTHENTIK_POSTGRESQL__HOST=host1,host2,...
but we cannot add arbitrary options like we could if we were provided with a connection URI option. This is causing issues as I am attempting to connect this to a highly available postgres cluster which uses a connection string like that below in order to only connect to the currently active master.
postgres://writer1:5432,writer2:5432,.../exampledb?target_session_attrs=read-write&....
Proposed Solution
Add something like:
AUTHENTIK_POSTGRESQL__DATABASE_OPTIONS='{"target_session_attrs":"read-write", ...}'
To allow users to define arbitrary connection data. Notably this options string should be different between read replicas and main host as, for example in my use case, target_session_attrs=read-write would prevent any read replicas from connecting.
Additional Context
A proof-of-concept implementation is available in this fork:
stazio#1