mirror of
https://github.com/containrrr/watchtower.git
synced 2025-09-22 05:40:50 +02:00
Allow running periodic updates with enabled HTTP API (#916)
* Allow running periodic updates with enabled HTTP API * Add --http-api-periodic-polls to docs
This commit is contained in:
parent
e308521a95
commit
6b155a111a
6 changed files with 55 additions and 12 deletions
|
@ -151,6 +151,11 @@ func RegisterSystemFlags(rootCmd *cobra.Command) {
|
|||
"",
|
||||
viper.GetString("WATCHTOWER_HTTP_API_TOKEN"),
|
||||
"Sets an authentication token to HTTP API requests.")
|
||||
flags.BoolP(
|
||||
"http-api-periodic-polls",
|
||||
"",
|
||||
viper.GetBool("WATCHTOWER_HTTP_API_PERIODIC_POLLS"),
|
||||
"Also run periodic updates (specified with --interval and --schedule) if HTTP API is enabled")
|
||||
// https://no-color.org/
|
||||
flags.BoolP(
|
||||
"no-color",
|
||||
|
|
|
@ -79,3 +79,18 @@ func testGetSecretsFromFiles(t *testing.T, flagName string, expected string) {
|
|||
|
||||
assert.Equal(t, expected, value)
|
||||
}
|
||||
|
||||
func TestHTTPAPIPeriodicPollsFlag(t *testing.T) {
|
||||
cmd := new(cobra.Command)
|
||||
SetDefaults()
|
||||
RegisterDockerFlags(cmd)
|
||||
RegisterSystemFlags(cmd)
|
||||
|
||||
err := cmd.ParseFlags([]string{"--http-api-periodic-polls"})
|
||||
require.NoError(t, err)
|
||||
|
||||
periodicPolls, err := cmd.PersistentFlags().GetBool("http-api-periodic-polls")
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, true, periodicPolls)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue