-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[configtls] Add NewDefault* funcs #9658
[configtls] Add NewDefault* funcs #9658
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #9658 +/- ##
=======================================
Coverage 91.95% 91.95%
=======================================
Files 357 357
Lines 16501 16509 +8
=======================================
+ Hits 15173 15181 +8
Misses 1000 1000
Partials 328 328 ☔ View full report in Codecov by Sentry. |
d03acab
to
aa74598
Compare
@@ -75,6 +75,11 @@ type Config struct { | |||
ReloadInterval time.Duration `mapstructure:"reload_interval"` | |||
} | |||
|
|||
// NewDefaultConfig creates a new TLSSetting with any default values set. | |||
func NewDefaultConfig() 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.
Is there a need for this from users perspective? Or we think it is enough only the Client/Server? Happy to keep it if we have few needs.
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.
I dont have a specific user cases, only following the pattern defined in https://github.com/open-telemetry/opentelemetry-collector/blob/main/CONTRIBUTING.md#default-configuration. The pattern implies to me that we should have a NewDefault
for all public config APIs. It is probably overkill, but it does allow us to add new default values to Config
in the future if we want.
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.
I'd rather have the NewDefaultConfig
function.
One thing is that we can use it in the NewDefaultClientConfig
and NewDefaultServerConfig
, although admittedly it doesn't need to be exported for this.
The other thing is that users can create their own configs that embed the configtls.Config
struct and then they can use the configtls.NewDefaultConfig
to create their instances of their configs.
I hope you don't ask me for potential examples of other configs that embed configtls.Config
, because I don't have any such examples. 😄
9921986
to
659685e
Compare
Description:
Adds new
NewDefault*
funcs for all 3 config structs.In anticipation of the name changes from #9495 I've named the functions using the new, preferred name.
Link to tracking Issue:
Closes #9657
Testing:
Added tests
Documentation:
godoc