Merge pull request #2210 from praxist/default_drone_yml

Add server env var to specify .drone.yml location
This commit is contained in:
Brad Rydzewski 2017-09-13 08:13:58 -07:00 committed by GitHub
commit d9cb6ff866
3 changed files with 9 additions and 1 deletions

View file

@ -93,6 +93,12 @@ var flags = []cli.Flag{
Name: "open",
Usage: "open user registration",
},
cli.StringFlag{
EnvVar: "DRONE_REPO_CONFIG",
Name: "repo-config",
Usage: "file path for the drone config",
Value: ".drone.yml",
},
cli.DurationFlag{
EnvVar: "DRONE_SESSION_EXPIRES",
Name: "session-expires",
@ -639,6 +645,7 @@ func setupEvilGlobals(c *cli.Context, v store.Store, r remote.Remote) {
droneserver.Config.Server.Pass = c.String("agent-secret")
droneserver.Config.Server.Host = strings.TrimRight(c.String("server-host"), "/")
droneserver.Config.Server.Port = c.String("server-addr")
droneserver.Config.Server.RepoConfig = c.String("repo-config")
droneserver.Config.Server.SessionExpires = c.Duration("session-expires")
droneserver.Config.Pipeline.Networks = c.StringSlice("network")
droneserver.Config.Pipeline.Volumes = c.StringSlice("volume")

View file

@ -45,7 +45,7 @@ func PostRepo(c *gin.Context) {
}
}
if repo.Config == "" {
repo.Config = ".drone.yml"
repo.Config = Config.Server.RepoConfig
}
if repo.Timeout == 0 {
repo.Timeout = 60 // 1 hour default build time

View file

@ -60,6 +60,7 @@ var Config = struct {
Host string
Port string
Pass string
RepoConfig string
SessionExpires time.Duration
// Open bool
// Orgs map[string]struct{}