INNER CODE UNIT · Go
Execute
nicholas-fedor/watchtower · cmd/root.go:155
func Execute(log *zerolog.Logger) {
proc := &process{log: log}
rootCmd.PreRun = proc.preRun
rootCmd.Run = proc.run
err := rootCmd.Execute()
if err != nil {
// Prefer proc.log so post-SetupLogging errors use the configured format/level.
proc.log.Fatal().Err(err).Msg("Failed to execute root command")
}
}
// preRun prepares the environment and configuration before the main command execution begins.
//
// It processes command-line flag aliases, configures logging based on verbosity settings,
// expands secrets from files, maps Docker flags into the process environment, loads the
// immutable appconfig snapshot, initializes the Docker client and notification client, and
// handles early-exit paths (ephemeral self-update orchestrator and invalid old-container restarts).