| OLD | NEW |
| 1 // Copyright 2016 The LUCI Authors. All rights reserved. | 1 // Copyright 2016 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // Package bootstrap handles Butler-side bootstrapping functionality. | 5 // Package bootstrap handles Butler-side bootstrapping functionality. |
| 6 package bootstrap | 6 package bootstrap |
| 7 | 7 |
| 8 import ( | 8 import ( |
| 9 "github.com/luci/luci-go/common/config" | |
| 10 "github.com/luci/luci-go/common/system/environ" | 9 "github.com/luci/luci-go/common/system/environ" |
| 11 "github.com/luci/luci-go/logdog/client/butlerlib/bootstrap" | 10 "github.com/luci/luci-go/logdog/client/butlerlib/bootstrap" |
| 12 "github.com/luci/luci-go/logdog/common/types" | 11 "github.com/luci/luci-go/logdog/common/types" |
| 12 "github.com/luci/luci-go/luci_config/common/cfgtypes" |
| 13 ) | 13 ) |
| 14 | 14 |
| 15 // Environment is the set of configuration parameters for the bootstrap. | 15 // Environment is the set of configuration parameters for the bootstrap. |
| 16 type Environment struct { | 16 type Environment struct { |
| 17 // CoordinatorHost is the coordinator host name, or empty string if we a
re | 17 // CoordinatorHost is the coordinator host name, or empty string if we a
re |
| 18 // not outputting to a Coordinator. | 18 // not outputting to a Coordinator. |
| 19 CoordinatorHost string | 19 CoordinatorHost string |
| 20 | 20 |
| 21 // Project is the project name. If not empty, this will be exported to | 21 // Project is the project name. If not empty, this will be exported to |
| 22 // subprocesses. | 22 // subprocesses. |
| 23 » Project config.ProjectName | 23 » Project cfgtypes.ProjectName |
| 24 // Prefix is the prefix name. If not empty, this will be exported to | 24 // Prefix is the prefix name. If not empty, this will be exported to |
| 25 // subprocesses. | 25 // subprocesses. |
| 26 Prefix types.StreamName | 26 Prefix types.StreamName |
| 27 // StreamServerURI is the streamserver URI. If not empty, this will be | 27 // StreamServerURI is the streamserver URI. If not empty, this will be |
| 28 // exported to subprocesses. | 28 // exported to subprocesses. |
| 29 StreamServerURI string | 29 StreamServerURI string |
| 30 } | 30 } |
| 31 | 31 |
| 32 // Augment augments the supplied base environment with LogDog Butler bootstrap | 32 // Augment augments the supplied base environment with LogDog Butler bootstrap |
| 33 // parameters. | 33 // parameters. |
| 34 func (e *Environment) Augment(base environ.Env) { | 34 func (e *Environment) Augment(base environ.Env) { |
| 35 exportIf := func(envKey, v string) { | 35 exportIf := func(envKey, v string) { |
| 36 if v != "" { | 36 if v != "" { |
| 37 base.Set(envKey, v) | 37 base.Set(envKey, v) |
| 38 } | 38 } |
| 39 } | 39 } |
| 40 | 40 |
| 41 exportIf(bootstrap.EnvCoordinatorHost, e.CoordinatorHost) | 41 exportIf(bootstrap.EnvCoordinatorHost, e.CoordinatorHost) |
| 42 exportIf(bootstrap.EnvStreamPrefix, string(e.Prefix)) | 42 exportIf(bootstrap.EnvStreamPrefix, string(e.Prefix)) |
| 43 exportIf(bootstrap.EnvStreamProject, string(e.Project)) | 43 exportIf(bootstrap.EnvStreamProject, string(e.Project)) |
| 44 exportIf(bootstrap.EnvStreamServerPath, e.StreamServerURI) | 44 exportIf(bootstrap.EnvStreamServerPath, e.StreamServerURI) |
| 45 } | 45 } |
| OLD | NEW |