forked from toolshed/abra
28
pkg/runtime/config.go
Normal file
28
pkg/runtime/config.go
Normal file
@ -0,0 +1,28 @@
|
||||
package runtime
|
||||
|
||||
import "github.com/sirupsen/logrus"
|
||||
|
||||
type Config struct {
|
||||
Offline bool
|
||||
}
|
||||
|
||||
type Option func(c *Config)
|
||||
|
||||
func New(opts ...Option) *Config {
|
||||
conf := &Config{Offline: false}
|
||||
|
||||
for _, optFunc := range opts {
|
||||
optFunc(conf)
|
||||
}
|
||||
|
||||
return conf
|
||||
}
|
||||
|
||||
func WithOffline(offline bool) Option {
|
||||
return func(c *Config) {
|
||||
if offline {
|
||||
logrus.Debugf("runtime config: attempting to run in offline mode")
|
||||
}
|
||||
c.Offline = offline
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user