remove auth basic command to improve config code

This commit is contained in:
David Christofas
2022-04-25 15:43:15 +02:00
parent 634d557279
commit 57e4e70888
14 changed files with 505 additions and 190 deletions
@@ -17,6 +17,9 @@ type Options struct {
Logger log.Logger
Context context.Context
Config *config.Config
Pprof bool
Zpages bool
Token string
}
// newOptions initializes the available default options.
@@ -64,3 +67,24 @@ func Config(val *config.Config) Option {
o.Config = val
}
}
// Pprof provides a function to set the pprof option.
func Pprof(val bool) Option {
return func(o *Options) {
o.Pprof = val
}
}
// Zpages provides a function to set the zpages option.
func Zpages(val bool) Option {
return func(o *Options) {
o.Zpages = val
}
}
// Token provides a function to set the token option.
func Token(val string) Option {
return func(o *Options) {
o.Token = val
}
}
@@ -18,9 +18,9 @@ func Server(opts ...Option) (*http.Server, error) {
debug.Name(options.Name),
debug.Version(version.String),
debug.Address(options.Addr),
debug.Token(options.Config.Debug.Token),
debug.Pprof(options.Config.Debug.Pprof),
debug.Zpages(options.Config.Debug.Zpages),
debug.Token(options.Token),
debug.Pprof(options.Pprof),
debug.Zpages(options.Zpages),
debug.Health(health(options.Config)),
debug.Ready(ready(options.Config)),
), nil