Skip to content

Commit

Permalink
Expose ConfigMapUpdater
Browse files Browse the repository at this point in the history
  • Loading branch information
ldemailly committed Oct 10, 2023
1 parent 0776218 commit ae8d469
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions scli.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import (
"fortio.org/version"
)

var ConfigMapUpdater *configmap.Updater // Expose the updater if advanced callers want to check warnings or stop it etc.

// NormalizePort parses port and returns host:port if port is in the form
// of host:port already or :port if port is only a port (doesn't contain :).
// Copied from fortio.org/fnet.NormalizePort to avoid dependency loop.
Expand Down Expand Up @@ -76,11 +78,12 @@ func ServerMain() bool {
cli.ServerMode = true
cli.Main() // will call ExitFunction() if there are usage errors
if *configDir != "" {
updt, err := configmap.Setup(flag.CommandLine, *configDir)
var err error
ConfigMapUpdater, err = configmap.Setup(flag.CommandLine, *configDir)
if err != nil {
log.Critf("Unable to watch config/flag changes in %v: %v", *configDir, err)
} else if updt.Warnings() != 0 {
log.S(log.Warning, "Unknown flags found", log.Int("count", updt.Warnings()), log.Str("dir", *configDir))
} else if ConfigMapUpdater.Warnings() != 0 {
log.S(log.Warning, "Unknown flags found", log.Int("count", ConfigMapUpdater.Warnings()), log.Str("dir", *configDir))
}
}

Expand Down

0 comments on commit ae8d469

Please sign in to comment.