mirror of
https://github.com/denyskon/teabag
synced 2024-11-22 08:50:40 +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"
|
host="localhost"
|
||||||
port="3000"
|
port="3000"
|
||||||
sessionSecret="super-secret"
|
sessionSecret="super-secret"
|
||||||
|
publicProto="https"
|
||||||
|
public="oauth.example.com"
|
||||||
|
publicPort="443"
|
||||||
|
|
||||||
# Delete if not in use
|
# Delete if not in use
|
||||||
[gitea]
|
[gitea]
|
||||||
@ -14,7 +17,7 @@ baseURL="https://gitea.yourcompany.com"
|
|||||||
authURI=
|
authURI=
|
||||||
accessTokenURI=
|
accessTokenURI=
|
||||||
userURI=
|
userURI=
|
||||||
callbackURI="http://localhost:3000/callback/gitea"
|
callbackURI="https://oauth.example.com/callback/gitea"
|
||||||
|
|
||||||
# Delete if not in use
|
# Delete if not in use
|
||||||
[gitlab]
|
[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'
|
// redirect to correct auth/{provider} URL if Auth request is submited with a query param '&provider=X'
|
||||||
// TODO: Remove hardcoded http://
|
// TODO: Remove hardcoded http://
|
||||||
r.HandleFunc("/auth", func(w http.ResponseWriter, r *http.Request) {
|
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"))
|
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)
|
log.Infof("redirecting to '%s'\n", URL)
|
||||||
http.Redirect(w, r, URL, http.StatusTemporaryRedirect)
|
http.Redirect(w, r, URL, http.StatusTemporaryRedirect)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user