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:
Brad Rydzewski 2017-12-20 00:42:50 -05:00 committed by GitHub
commit af273e8918
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)