Validate DRONE_HOST to ensure it contains a scheme and not a trailing slash

This commit is contained in:
Jesse Lang 2017-12-19 20:08:55 -06:00
parent 1db7bde877
commit 453f415cc4

View file

@ -477,6 +477,18 @@ func server(c *cli.Context) error {
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)
if err != nil {
logrus.Fatal(err)