feature: add optional environment variable to set superuser e-mail
Problem
I deploy linkding (LD) to a NixOS machine and manage its configuration with the services.linkding.* NixOS module. LD_ENABLE_OIDC is set to True. I have configured LD with my personal IdP via the OIDC_* options and LD_SUPERUSER_NAME set to the same value returned by preferred_username claim from IdP.
I was expecting to login with OIDC and immediately have administrator/super user role. However, I did run into the same issue explained in #988.
The workaround is to create super user manually with manage.py and specify e-mail as per disclaimer on documentation [1]. However, with my declarative setup with Nix. It doesn't quite sit right with me and the solution is very simple.
Proposal
- Add an optional environment variable,
LD_SUPERUSER_EMAIL, which will set theemailproperty onUsermodel increate_initial_superuser.py
Then on subsequent OIDC login, LD will map the logged in user to the LD_SUPERUSER_NAME and LD_SUPERUSER_EMAIL.
Environment
- system:
"x86_64-linux" - host os:
Linux 6.18.41, NixOS, 26.11 (Zokor), 26.11.20260803.104240a - app version:
v1.46.2
[1] https://linkding.link/options/#oidc-and-ld_superuser_name
Source: sissbruecker/linkding