feat: update example compose, change default redirect

This commit is contained in:
httpjamesm 2022-12-28 11:57:08 -05:00
parent d92edafb03
commit d664899ab6
2 changed files with 4 additions and 2 deletions

View File

@ -6,6 +6,8 @@ services:
build: build:
context: . context: .
network: 'host' network: 'host'
environment:
- APP_URL=https://domain.com
ports: ports:
- '80:8080' - '80:8080'
restart: 'always' restart: 'always'

View File

@ -28,11 +28,11 @@ func ChangeOptions(c *gin.Context) {
// get redirect url from query // get redirect url from query
redirectUrl := c.Query("redirect_url") redirectUrl := c.Query("redirect_url")
if redirectUrl == "" { if redirectUrl == "" {
redirectUrl = "/" redirectUrl = os.Getenv("APP_URL")
} }
if !strings.HasPrefix(redirectUrl, os.Getenv("APP_URL")) { if !strings.HasPrefix(redirectUrl, os.Getenv("APP_URL")) {
redirectUrl = "/" redirectUrl = os.Getenv("APP_URL")
} }
c.Redirect(302, redirectUrl) c.Redirect(302, redirectUrl)