Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,9 @@ func New(opts *Options) *Server {
// The provided Options type should not be re-used afterwards.
// Either use Options.Clone() to pass a copy, or make a new one.
func NewServer(opts *Options) (*Server, error) {
if opts.ConfigFile != _EMPTY_ {
opts.ProcessConfigFile(opts.ConfigFile)
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be surprising if NewServer() changes my passed options like this without some opt-in.

It might be better to add a helper function like NewServerFromConfig(file string) or something like that? Else maybe gate this behaviour on having passed a nil options with clear docs callout about that - but that doesn't seem so nice.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mentioned issue also uses some other options instead of just the config file.
Why not call opts.ProcessConfigFile(opts.ConfigFile) right before calling NewServer on the options when embedding? (that's the same thing the server already does when combining CLI flags, etc.)

setBaselineOptions(opts)

// Process TLS options, including whether we require client certificates.
Expand Down
Loading