m: add CfgSource and use it in all current cmds
This commit is contained in:
parent
132c51eaf0
commit
7f0b8056d7
@ -104,7 +104,7 @@ func main() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
mhttp.CfgServer(cfg, authHandler)
|
mhttp.CfgServer(cfg, authHandler)
|
||||||
if err := cfg.StartRun(context.Background(), new(mcfg.SourceCLI)); err != nil {
|
if err := cfg.StartRun(context.Background(), m.CfgSource()); err != nil {
|
||||||
mlog.Fatal("error during startup", mlog.ErrKV(err))
|
mlog.Fatal("error during startup", mlog.ErrKV(err))
|
||||||
}
|
}
|
||||||
select {}
|
select {}
|
||||||
|
9
m/m.go
9
m/m.go
@ -11,6 +11,15 @@ import (
|
|||||||
"github.com/mediocregopher/mediocre-go-lib/mlog"
|
"github.com/mediocregopher/mediocre-go-lib/mlog"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// CfgSource returns an mcfg.Source which takes in configuration info from the
|
||||||
|
// environment and from the CLI.
|
||||||
|
func CfgSource() mcfg.Source {
|
||||||
|
return mcfg.Sources{
|
||||||
|
mcfg.SourceEnv{},
|
||||||
|
mcfg.SourceCLI{},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO this isn't going to work. At some point there will be something like
|
// TODO this isn't going to work. At some point there will be something like
|
||||||
// mhttp which will have some glue code for it in here, but then something
|
// mhttp which will have some glue code for it in here, but then something
|
||||||
// within it which logs (like the http server), and then there'll be an import
|
// within it which logs (like the http server), and then there'll be an import
|
||||||
|
Loading…
Reference in New Issue
Block a user