1
0
mirror of https://github.com/MontFerret/ferret.git synced 2025-11-06 08:39:09 +02:00

minor tweak in runtime.Options

This commit is contained in:
Tim Voronov
2018-10-17 22:57:36 -04:00
parent 17b52fdfd5
commit e0874d25f7
2 changed files with 11 additions and 9 deletions

View File

@@ -22,7 +22,7 @@ type (
Option func(*Options)
)
func newOptions() *Options {
func NewOptions() *Options {
return &Options{
cdp: "http://0.0.0.0:9222",
params: make(map[string]core.Value),
@@ -83,7 +83,15 @@ func WithLogLevel(lvl logging.Level) Option {
}
}
func (opts *Options) withContext(parent context.Context) context.Context {
func (opts *Options) Apply(setters ...Option) *Options {
for _, setter := range setters {
setter(opts)
}
return opts
}
func (opts *Options) WithContext(parent context.Context) context.Context {
ctx := core.ParamsWith(parent, opts.params)
ctx = logging.WithContext(ctx, opts.logging)
ctx = env.WithContext(ctx, env.Environment{