mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-30 05:41:12 +00:00
Merge pull request #2286 from jesselang/feature/drone-host-must-include-scheme
Validate DRONE_HOST to ensure it contains a scheme and not a trailing slash
This commit is contained in:
commit
af273e8918
1 changed files with 12 additions and 0 deletions
|
@ -477,6 +477,18 @@ func server(c *cli.Context) error {
|
||||||
logrus.Fatalln("DRONE_HOST is not properly configured")
|
logrus.Fatalln("DRONE_HOST is not properly configured")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !strings.Contains(c.String("server-host"), "://") {
|
||||||
|
logrus.Fatalln(
|
||||||
|
"DRONE_HOST must be <scheme>://<hostname> format",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !strings.HasSuffix(c.String("server-host"), "/") {
|
||||||
|
logrus.Fatalln(
|
||||||
|
"DRONE_HOST must not have trailing slash",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
remote_, err := SetupRemote(c)
|
remote_, err := SetupRemote(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
|
|
Loading…
Reference in a new issue