зеркало из https://github.com/mozilla/mig.git
loader: load configuration from external configuration file
This commit is contained in:
Родитель
f8ce1c0b6d
Коммит
40b8bf25a1
|
@ -0,0 +1,39 @@
|
|||
; Sample MIG Loader configuration file
|
||||
|
||||
[loader]
|
||||
; location of the mig api
|
||||
api = "http://localhost:1664/api/v1/"
|
||||
|
||||
; comma delimited list of host:port proxies to use, if desired
|
||||
; the loader will attempt to try to proxies for manifest retrieval
|
||||
; proxies = "proxy1:8888,proxy2:8888"
|
||||
|
||||
; attempt to retrieve the public IP behind which the loader is running
|
||||
discoverpublicip = off
|
||||
|
||||
; attempt to retrieve AWS metadata from the metadata service to include in the environment
|
||||
; sent to the API
|
||||
discoverawsmeta = off
|
||||
|
||||
; the number of signatures required in a manifest for the manifest to be considered
|
||||
; valid
|
||||
requiredsignatures = 1
|
||||
|
||||
; Tags can be specified for a given loader at compile-time using the loader built-in
|
||||
; configuration TAGS value. Additional tags can be included in the configuration file
|
||||
; here if desired to override or extend the tags the loader has already been compiled
|
||||
; with.
|
||||
; tags = "tagname:tagvalue"
|
||||
|
||||
[logging]
|
||||
mode = "stdout" ; stdout | file | syslog
|
||||
level = "debug"
|
||||
|
||||
; for file logging
|
||||
; file = "mig_scheduler.log"
|
||||
; maxfilesize = 0 ; if > 0, log file will be rotated once it reaches size
|
||||
|
||||
; for syslog, logs go into local3
|
||||
; host = "localhost"
|
||||
; port = 514
|
||||
; protocol = "udp"
|
|
@ -391,13 +391,7 @@ func initContext() (err error) {
|
|||
}
|
||||
}()
|
||||
|
||||
ctx.Channels.Log = make(chan mig.Log, 37)
|
||||
ctx.Logging, err = getLoggingConf()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
ctx.Logging, err = mig.InitLogger(ctx.Logging, "mig-loader")
|
||||
ctx.Logging, err = mig.InitLogger(LOGGINGCONF, "mig-loader")
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
||||
os.Exit(1)
|
||||
|
@ -406,8 +400,6 @@ func initContext() (err error) {
|
|||
go func() {
|
||||
var stop bool
|
||||
for event := range ctx.Channels.Log {
|
||||
// Also write the message to stderr to ease debugging
|
||||
fmt.Fprintf(os.Stderr, "%v\n", event.Desc)
|
||||
stop, err = mig.ProcessLog(ctx.Logging, event)
|
||||
if err != nil {
|
||||
panic("unable to process log")
|
||||
|
@ -538,16 +530,27 @@ func main() {
|
|||
var (
|
||||
initialMode bool
|
||||
runService bool
|
||||
confPath string
|
||||
checkOnly bool
|
||||
err error
|
||||
)
|
||||
runtime.GOMAXPROCS(1)
|
||||
|
||||
flag.BoolVar(&checkOnly, "c", false, "only check if agent is running")
|
||||
flag.StringVar(&confPath, "f", configDefault(), "Load configuration from file")
|
||||
flag.BoolVar(&initialMode, "i", false, "initialization mode")
|
||||
flag.BoolVar(&runService, "s", false, "persistent service mode")
|
||||
flag.Parse()
|
||||
|
||||
ctx.Channels.Log = make(chan mig.Log, 37)
|
||||
|
||||
err = configLoad(confPath)
|
||||
if err != nil {
|
||||
logInfo("warning: unable to load configuration from %v, using built-in configuration", confPath)
|
||||
} else {
|
||||
logInfo("using external configuration from %v", confPath)
|
||||
}
|
||||
|
||||
if runService {
|
||||
err = serviceMode()
|
||||
if err != nil {
|
||||
|
|
Загрузка…
Ссылка в новой задаче