permitir definir public_url
This commit is contained in:
parent
c575551d2e
commit
832a4a9fc3
2 changed files with 7 additions and 2 deletions
|
@ -36,6 +36,7 @@ type config struct {
|
||||||
giteaUrl string
|
giteaUrl string
|
||||||
giteaUsername string
|
giteaUsername string
|
||||||
giteaPassword string
|
giteaPassword string
|
||||||
|
publicUrl string
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseConfig() (c config) {
|
func parseConfig() (c config) {
|
||||||
|
@ -59,5 +60,10 @@ func parseConfig() (c config) {
|
||||||
log.Fatal("GITEA_PASSWORD is nil")
|
log.Fatal("GITEA_PASSWORD is nil")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if c.publicUrl = os.Getenv("PUBLIC_URL"); len(c.publicUrl) == 0 {
|
||||||
|
log.Println("PUBLIC_URL is not defined, will default to localhost:8080")
|
||||||
|
c.publicUrl = "http://localhost:8080"
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,8 +140,7 @@ func (h webhook) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
runId := req.Header.Get("X-Gitea-Delivery")
|
runId := req.Header.Get("X-Gitea-Delivery")
|
||||||
// TODO: make dynamic
|
runUrl := h.config.publicUrl + "/#" + runId
|
||||||
runUrl := "http://localhost:8080/#" + runId
|
|
||||||
log.Printf("New run: %s", runUrl)
|
log.Printf("New run: %s", runUrl)
|
||||||
run := runss.newRun(runId)
|
run := runss.newRun(runId)
|
||||||
defer run.finishRun()
|
defer run.finishRun()
|
||||||
|
|
Loading…
Reference in a new issue