-
Notifications
You must be signed in to change notification settings - Fork 4
Add client configurations #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| return NewWithConfig(writeKey, Config{}) | ||
| } | ||
|
|
||
| func NewWithConfig(writeKey string, config Config) *Client { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think if Config contains the writeKey?
func New(writeKey string) *Client {
return NewWithConfig(Config{WriteKey: writeKey})
}
func NewWithConfig(config Config) *Client {
...
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Configs tend to imply optionality. The writekey is not optional. I am not sure it belongs in the config
client.go
Outdated
| } | ||
| } | ||
|
|
||
| func getFinalConfig(c Config) Config { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getFinalConfig doesn't really explain much.
Could you consider rename/refactor to
func applyDefaultConfig(c *Config){
// sets default inline
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
naming is hard. How do parents do this
Source config
* Release v0.0.2-webhookfn * hide sensitive payload request. support PrintErrors using Config * update message * Release v1.0.0-webhookfn
* origin/master: Fix time.Ticker leak in Client go fmt dep -> go module
|
I'm going to merge and tag this release as v2.0.0 because it's a breaking API change (albeit minor). |
Add new function to allow creating clients with configurations