remove auth basic command to improve config code
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user