Skip to content
Open
Show file tree
Hide file tree
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
10 changes: 8 additions & 2 deletions server/opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,9 @@ type Options struct {

// configDigest represents the state of configuration.
configDigest string

// configWarnings holds warnings from config parsing to be logged once the server starts.
configWarnings []error
}

// WebsocketOpts are options for websocket
Expand Down Expand Up @@ -1028,6 +1031,9 @@ func (o *Options) processConfigFile(configFile string, m map[string]any) error {
}
}

// Store warnings in Options so they can be logged once the server starts.
o.configWarnings = warnings

if len(errors) > 0 || len(warnings) > 0 {
return &processConfigErr{
errors: errors,
Expand Down Expand Up @@ -6186,8 +6192,8 @@ func ConfigureOptions(fs *flag.FlagSet, args []string, printVersion, printHelp,
if cerr, ok := err.(*processConfigErr); !ok || len(cerr.Errors()) != 0 {
return nil, err
}
// If we get here we only have warnings and can still continue
fmt.Fprint(os.Stderr, err)
// If we get here we only have warnings; they are stored in opts.configWarnings
// and will be logged when the server starts.
} else if opts.CheckConfig {
// Report configuration file syntax test was successful and exit.
return opts, nil
Expand Down
6 changes: 6 additions & 0 deletions server/reload.go
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,12 @@ func (s *Server) ReloadOptions(newOpts *Options) error {
return err
}

// Log any warnings from config parsing.
for _, warn := range newOpts.configWarnings {
s.Warnf("Configuration warning: %v", warn)
}
newOpts.configWarnings = nil

s.recheckPinnedCerts(curOpts, newOpts)

s.mu.Lock()
Expand Down
6 changes: 6 additions & 0 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2332,6 +2332,12 @@ func (s *Server) Start() {
s.Noticef("Using configuration file: %s %s", opts.ConfigFile, cd)
}

// Log any warnings from config parsing.
for _, warn := range opts.configWarnings {
s.Warnf("Configuration warning: %v", warn)
}
opts.configWarnings = nil

hasOperators := len(opts.TrustedOperators) > 0
if hasOperators {
s.Noticef("Trusted Operators")
Expand Down
Loading