fix(grfn/bbbg): Configure web base url
This was originally intended to work around the issue caused by me accidentally ending up proxy_set_header'ing the Host header twice (which nginx *concatenates with slashes*, rather than overwriting!), but seems sensible regardless to make that whole thing (hopefully) a bit less brittle Change-Id: I877fa594b46e88d1ba05e793832beab3d0aaccdd Reviewed-on: https://cl.tvl.fyi/c/depot/+/4697 Reviewed-by: grfn <grfn@gws.fyi> Autosubmit: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
This commit is contained in:
parent
78f2bf9371
commit
67942f7447
3 changed files with 15 additions and 5 deletions
|
@ -71,6 +71,7 @@ in {
|
|||
PGUSER = cfg.database.user;
|
||||
PGDATABASE = cfg.database.name;
|
||||
PORT = toString cfg.port;
|
||||
BASE_URL = "https://${cfg.domain}";
|
||||
};
|
||||
|
||||
script = "${bbbg.server}/bin/bbbg-server";
|
||||
|
|
|
@ -54,15 +54,22 @@
|
|||
"guilds.members.read"
|
||||
"identify"])
|
||||
|
||||
(defn discord-oauth-profile [env]
|
||||
(defn discord-oauth-profile [{:keys [base-url] :as env}]
|
||||
{:authorize-uri authorization-url
|
||||
:access-token-uri access-token-url
|
||||
:client-id (::client-id env)
|
||||
:client-secret (::client-secret env)
|
||||
:scopes scopes
|
||||
:launch-uri "/auth/discord"
|
||||
:redirect-uri "/auth/discord/redirect"
|
||||
:landing-uri "/auth/success"})
|
||||
:redirect-uri (str base-url "/auth/discord/redirect")
|
||||
:landing-uri (str base-url "/auth/success")})
|
||||
|
||||
(comment
|
||||
(-> "https://bbbg-staging.gws.fyi/auth/login"
|
||||
(java.net.URI/create)
|
||||
(.resolve "https://bbbg.gws.fyi/auth/discord/redirect")
|
||||
str)
|
||||
)
|
||||
|
||||
(defn wrap-discord-auth [handler env]
|
||||
(wrap-oauth2 handler {:discord (discord-oauth-profile env)}))
|
||||
|
|
|
@ -38,7 +38,8 @@
|
|||
(s/def ::config
|
||||
(s/merge
|
||||
(s/keys :req [::port]
|
||||
:opt [::cookie-secret])
|
||||
:opt [::cookie-secret
|
||||
::base-url])
|
||||
::discord.auth/config))
|
||||
|
||||
(s/fdef make-server
|
||||
|
@ -58,7 +59,8 @@
|
|||
(u/remove-nils
|
||||
(merge
|
||||
{::port (:port env 8888)
|
||||
::cookie-secret (some-> env :cookie-secret string->cookie-secret)}
|
||||
::cookie-secret (some-> env :cookie-secret string->cookie-secret)
|
||||
::base-url (:base-url env)}
|
||||
(discord.auth/env->config)))))
|
||||
|
||||
(defn dev-config []
|
||||
|
|
Loading…
Reference in a new issue