Revive http service for serving assets. Streamlined flagset.

This commit is contained in:
Benedikt Kulmann
2020-04-21 22:43:22 +02:00
parent 4b612965d9
commit 2f42fcb35a
9 changed files with 148 additions and 194 deletions
+8 -8
View File
@@ -14,7 +14,7 @@ type Option func(o *Options)
// Options defines the available options for this package.
type Options struct {
Namespace string
Name string
Logger log.Logger
Context context.Context
Config *config.Config
@@ -40,6 +40,13 @@ func Logger(val log.Logger) Option {
}
}
// Name provides a name for the service.
func Name(val string) Option {
return func(o *Options) {
o.Name = val
}
}
// Context provides a function to set the context option.
func Context(val context.Context) Option {
return func(o *Options) {
@@ -67,10 +74,3 @@ func Flags(val []cli.Flag) Option {
o.Flags = append(o.Flags, val...)
}
}
// Namespace provides a function to set the Namespace option.
func Namespace(val string) Option {
return func(o *Options) {
o.Namespace = val
}
}