Commit 84509e38 authored by Łukasz Magiera's avatar Łukasz Magiera

coreapi: Global options for api constructor

License: MIT
Signed-off-by: default avatarŁukasz Magiera <magik6k@gmail.com>
parent d68c62b1
package options
type ApiSettings struct {
Offline bool
}
type ApiOption func(*ApiSettings) error
func ApiOptions(opts ...ApiOption) (*ApiSettings, error) {
options := &ApiSettings{
Offline: false,
}
for _, opt := range opts {
err := opt(options)
if err != nil {
return nil, err
}
}
return options, nil
}
type apiOpts struct{}
var Api dagOpts
func (dagOpts) Offline(offline bool) ApiOption {
return func(settings *ApiSettings) error {
settings.Offline = offline
return nil
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment