Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
f9483c5
refactor: centralize process configuration behind a single Load path
nicholas-fedor Jul 26, 2026
be2053d
refactor(config): align CPUCopyMode precedence with UpdateParams
nicholas-fedor Jul 26, 2026
2726e82
fix(flags): ignore empty boolean env vars unless key is NO_COLOR
nicholas-fedor Jul 26, 2026
29be48a
refactor(flags): unify NO_COLOR presence semantics across flag binding
nicholas-fedor Jul 26, 2026
81cb348
refactor(flags): remove static default registration functions
nicholas-fedor Jul 26, 2026
3614628
fix(scheduling): unify filter source for scheduled upgrade runs
nicholas-fedor Jul 26, 2026
4286382
refactor(flags): batch BindEnv calls to preserve env key precedence
nicholas-fedor Jul 26, 2026
cff0035
docs(flags): update architecture documentation for unified flag binding
nicholas-fedor Jul 26, 2026
20b7a04
test(flags): add assertions for duration and string array env bridging
nicholas-fedor Jul 26, 2026
0502bf0
refactor(flags): extract notification URL parsing tests to utils package
nicholas-fedor Jul 26, 2026
06ba6b2
refactor(utils): extract DurationFromSeconds helper for overflow-safe…
nicholas-fedor Jul 26, 2026
e8703a0
refactor(scheduling): remove redundant local variable assignments in …
nicholas-fedor Jul 26, 2026
c4095a3
refactor(logging): delegate suppression handling to WriteStartupMessa…
nicholas-fedor Jul 26, 2026
2686d7a
refactor(logging): consolidate scheduling fields into embedded Schedu…
nicholas-fedor Jul 26, 2026
ae45f32
test(scheduling): extract testDeps helper to reduce ScheduleDeps boil…
nicholas-fedor Jul 26, 2026
dcf6939
refactor(cmd): consolidate shared base params to eliminate redundant …
nicholas-fedor Jul 26, 2026
f383b3a
test(cmd): extract testScheduleDeps helper to reduce test boilerplate
nicholas-fedor Jul 26, 2026
447930b
test(logging): refine SetupStartupLogger test assertions for nil noti…
nicholas-fedor Jul 26, 2026
6d74f2e
fix(notifier): prevent token leakage in debug logs
nicholas-fedor Jul 26, 2026
6ab5738
refactor(cmd): use PersistentFlags to match config.Load bind source
nicholas-fedor Jul 26, 2026
cf079cf
test(notifier): update GetDelay test to use non-zero legacy delay
nicholas-fedor Jul 26, 2026
cda2700
fix(notifications): move sensitive URL logging to trace level
nicholas-fedor Jul 26, 2026
524b9e3
refactor(notifier): extract legacy flag parsing into dedicated function
nicholas-fedor Jul 26, 2026
37951ef
refactor: centralize notification delay calculation in GetDelay
nicholas-fedor Jul 26, 2026
6a6e006
refactor(notifier): replace type switch with constructor lookup for l…
nicholas-fedor Jul 26, 2026
2712989
refactor(scheduling): centralize startup message parameter initializa…
nicholas-fedor Jul 26, 2026
e4e5482
refactor(config): extract normalized string slice loading helper
nicholas-fedor Jul 26, 2026
a4c149c
chore: eliminate manual overflow handling from duration parsing
nicholas-fedor Jul 26, 2026
9ea4407
refactor(flags): centralize list parsing in spec package
nicholas-fedor Jul 26, 2026
6adb5d9
refactor(flags): extract kind-specific registration helpers
nicholas-fedor Jul 26, 2026
b2a9c5e
fix(config): fall back to default for unparseable bare numeric durations
nicholas-fedor Jul 26, 2026
694e781
docs(notify): fix missing closing bracket in help text
nicholas-fedor Jul 26, 2026
a513bac
fix(flags): prevent sensitive token leakage in notification URL logs
nicholas-fedor Jul 26, 2026
8194c13
refactor(scheduling): add nil guard for RunUpdate hook
nicholas-fedor Jul 26, 2026
dc277e0
fix(notifications): redact sensitive credentials in notification logs
nicholas-fedor Jul 26, 2026
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
23 changes: 18 additions & 5 deletions cmd/notify-upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"

appconfig "github.com/nicholas-fedor/watchtower/internal/config"
"github.com/nicholas-fedor/watchtower/internal/flags"
"github.com/nicholas-fedor/watchtower/pkg/notifications"
)
Expand Down Expand Up @@ -67,12 +68,24 @@ func runNotifyUpgrade(cmd *cobra.Command, args []string) {
// completes successfully, including cleanup, indicating the notification upgrade process ran without fatal issues.
// Non-critical failures (e.g., file removal after timeout) are logged but do not result in an error return.
func runNotifyUpgradeE(cmd *cobra.Command, _ []string) error {
// Process flag aliases to normalize inputs from environment variables or shorthand flags, ensuring consistent configuration.
f := cmd.Flags()
flags.ProcessFlagAliases(f)
// Process flag aliases and expand secrets before resolving configuration.
// Use PersistentFlags so env/alias bridging matches config.Load's bind source.
flagSet := cmd.PersistentFlags()

// Initialize the notifier with flag-derived settings, extracting legacy notification configurations into shoutrrr URLs.
notifier := notifications.NewNotifier(cmd)
err := flags.ApplyEnvToFlags(flagSet, flags.AllSpecs())
if err != nil {
return fmt.Errorf("apply environment configuration: %w", err)
}

flags.ProcessFlagAliases(flagSet)
flags.GetSecretsFromFiles(cmd)

cfg, loadErr := appconfig.Load(cmd, nil)
if loadErr != nil {
return fmt.Errorf("load configuration: %w", loadErr)
}

notifier := notifications.NewNotifier(cfg.Notify)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
urls := notifier.GetURLs()

// Log the identified notification types (e.g., "email, slack") to inform the user of what configurations are being upgraded.
Expand Down
863 changes: 209 additions & 654 deletions cmd/root.go

Large diffs are not rendered by default.

Loading