From 0d7bd0b4dfdba220f14f0bdc23992bc1d6c7ad1a Mon Sep 17 00:00:00 2001 From: Nikos Katirtzis Date: Mon, 6 Aug 2018 22:41:10 +0100 Subject: [PATCH] Add more options to NewConfiguration using functional options. --- configuration.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/configuration.go b/configuration.go index 9f83ff0..380facb 100644 --- a/configuration.go +++ b/configuration.go @@ -55,12 +55,17 @@ type Configuration struct { } // NewConfiguration create new configuration -func NewConfiguration(basePath string) *Configuration { +func NewConfiguration(basePath string, options ...func(*Configuration)) *Configuration { cfg := &Configuration{ BasePath: basePath, DefaultHeader: make(map[string]string), UserAgent: "go-bitbucket/1.0.0/go", } + + for _, option := range options { + option(cfg) + } + return cfg }