mirror of
https://github.com/denyskon/teabag
synced 2024-11-22 02:10:39 +01:00
modernizations
This commit is contained in:
parent
9a91af1467
commit
79580c1c51
5
env/sample.config
vendored
5
env/sample.config
vendored
@ -5,6 +5,9 @@ environment="development"
|
||||
host="localhost"
|
||||
port="3000"
|
||||
sessionSecret="super-secret"
|
||||
publicProto="https"
|
||||
public="oauth.example.com"
|
||||
publicPort="443"
|
||||
|
||||
# Delete if not in use
|
||||
[gitea]
|
||||
@ -14,7 +17,7 @@ baseURL="https://gitea.yourcompany.com"
|
||||
authURI=
|
||||
accessTokenURI=
|
||||
userURI=
|
||||
callbackURI="http://localhost:3000/callback/gitea"
|
||||
callbackURI="https://oauth.example.com/callback/gitea"
|
||||
|
||||
# Delete if not in use
|
||||
[gitlab]
|
||||
|
3
main.go
3
main.go
@ -169,8 +169,9 @@ func main() {
|
||||
// redirect to correct auth/{provider} URL if Auth request is submited with a query param '&provider=X'
|
||||
// TODO: Remove hardcoded http://
|
||||
r.HandleFunc("/auth", func(w http.ResponseWriter, r *http.Request) {
|
||||
proto := config.GetString("server.publicProto")
|
||||
host := net.JoinHostPort(config.GetString("server.host"), config.GetString("server.port"))
|
||||
URL := fmt.Sprintf("http://%s/auth/%s", host, r.FormValue("provider"))
|
||||
URL := fmt.Sprintf("%s://%s/auth/%s", proto, host, r.FormValue("provider"))
|
||||
|
||||
log.Infof("redirecting to '%s'\n", URL)
|
||||
http.Redirect(w, r, URL, http.StatusTemporaryRedirect)
|
||||
|
Loading…
x
Reference in New Issue
Block a user