chore(web/panettone): Make it easier to override oauth settings

For local dev, it's nice to be able to set the oauth variables by hand
before starting the server - in that case, we don't want to override
them with the defaults.

Change-Id: I530518b4d58df1edf55ce062cf7ff3290784a3ed
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11259
Autosubmit: aspen <root@gws.fyi>
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
This commit is contained in:
Aspen Smith 2024-03-24 14:40:09 -04:00 committed by aspen
parent a80c0ce95f
commit 783972182e

View file

@ -42,23 +42,31 @@ the user, however email addresses are temporarily not available."
(or (uiop:getenv "OAUTH2_REDIRECT_URI")
"https://b.tvl.fyi/auth"))
(comment
(setq *oauth2-redirect-uri* "http://localhost:6161/auth")
)
(defun initialise-oauth2 ()
"Initialise all settings needed for OAuth2"
(setq *oauth2-auth-endpoint*
(or (uiop:getenv "OAUTH2_AUTH_ENDPOINT")
(or *oauth2-auth-endpoint*
(uiop:getenv "OAUTH2_AUTH_ENDPOINT")
"https://auth.tvl.fyi/auth/realms/TVL/protocol/openid-connect/auth"))
(setq *oauth2-token-endpoint*
(or (uiop:getenv "OAUTH2_TOKEN_ENDPOINT")
(or *oauth2-token-endpoint*
(uiop:getenv "OAUTH2_TOKEN_ENDPOINT")
"https://auth.tvl.fyi/auth/realms/TVL/protocol/openid-connect/token"))
(setq *oauth2-client-id*
(or (uiop:getenv "OAUTH2_CLIENT_ID")
(or *oauth2-client-id*
(uiop:getenv "OAUTH2_CLIENT_ID")
"panettone"))
(setq *oauth2-client-secret*
(or (uiop:getenv "OAUTH2_CLIENT_SECRET")
(or *oauth2-client-secret*
(uiop:getenv "OAUTH2_CLIENT_SECRET")
(error "OAUTH2_CLIENT_SECRET must be set!"))))
(defun auth-url ()