diff --git a/worker/sandbox.go b/worker/sandbox.go index 9b876a0..41a6865 100644 --- a/worker/sandbox.go +++ b/worker/sandbox.go @@ -8,10 +8,7 @@ import ( ) func NewSandbox(name string, options ...sandbox.Option) (sandbox.Runner, error) { - setting := sandbox.DefaultSettings - for _, option := range options { - setting = option(setting) - } + setting := sandbox.MakeSettings(options...) switch name { case "raw": return raw.New(setting), nil diff --git a/worker/sandbox/settings.go b/worker/sandbox/settings.go index ef528ad..8cbd68a 100644 --- a/worker/sandbox/settings.go +++ b/worker/sandbox/settings.go @@ -5,7 +5,7 @@ type Settings struct { IgnoreWarning bool } -var DefaultSettings = Settings{LogSandbox: true, IgnoreWarning: false} +var defaultSettings = Settings{LogSandbox: true, IgnoreWarning: false} type Option func(Settings) Settings @@ -22,3 +22,11 @@ func EnableSandboxLogs(enable bool) Option { return o } } + +func MakeSettings(options ...Option) Settings { + setting := defaultSettings + for _, option := range options { + setting = option(setting) + } + return setting +}