Merge pull request #16 from nikos912000/more-options-when-creating-new-configuration

More options when creating new configuration
This commit is contained in:
Sanket Patel 2018-08-07 10:21:21 -05:00 committed by GitHub
commit c259e352b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

6
.gitignore vendored
View File

@ -23,3 +23,9 @@ _testmain.go
*.test *.test
*.prof *.prof
.vscode .vscode
# OS generated files
.DS_Store
# IDEA files
**/.idea

View File

@ -55,12 +55,17 @@ type Configuration struct {
} }
// NewConfiguration create new configuration // NewConfiguration create new configuration
func NewConfiguration(basePath string) *Configuration { func NewConfiguration(basePath string, options ...func(*Configuration)) *Configuration {
cfg := &Configuration{ cfg := &Configuration{
BasePath: basePath, BasePath: basePath,
DefaultHeader: make(map[string]string), DefaultHeader: make(map[string]string),
UserAgent: "go-bitbucket/1.0.0/go", UserAgent: "go-bitbucket/1.0.0/go",
} }
for _, option := range options {
option(cfg)
}
return cfg return cfg
} }