diff --git a/internal/config/env_notifier.go b/internal/config/env_notifier.go index 3210024f..cc725d08 100644 --- a/internal/config/env_notifier.go +++ b/internal/config/env_notifier.go @@ -12,6 +12,9 @@ func ReadAndAppendShoutrrrURL(ppfmt pp.PP, key string, field *notifier.Notifier) return true } + ppfmt.Hintf(pp.HintExperimentalShoutrrr, + "You are using the experimental shoutrrr support added in version 1.12.0") + s, ok := notifier.NewShoutrrr(ppfmt, vals) if !ok { return false diff --git a/internal/config/env_notifier_test.go b/internal/config/env_notifier_test.go index 668526d5..7483161c 100644 --- a/internal/config/env_notifier_test.go +++ b/internal/config/env_notifier_test.go @@ -32,7 +32,8 @@ func TestReadAndAppendShoutrrrURL(t *testing.T) { t.Helper() require.Nil(t, n) }, - true, nil, + true, + nil, }, "empty": { true, "", nil, @@ -40,7 +41,8 @@ func TestReadAndAppendShoutrrrURL(t *testing.T) { t.Helper() require.Nil(t, n) }, - true, nil, + true, + nil, }, "generic": { true, "generic+https://example.com/api/v1/postStuff", @@ -55,7 +57,9 @@ func TestReadAndAppendShoutrrrURL(t *testing.T) { require.Equal(t, []string{"Generic"}, s.ServiceDescriptions) }, true, - nil, + func(m *mocks.MockPP) { + m.EXPECT().Hintf(pp.HintExperimentalShoutrrr, "You are using the experimental shoutrrr support added in version 1.12.0") //nolint:lll + }, }, "ill-formed": { true, "meow-meow-meow://cute", @@ -66,6 +70,7 @@ func TestReadAndAppendShoutrrrURL(t *testing.T) { }, false, func(m *mocks.MockPP) { + m.EXPECT().Hintf(pp.HintExperimentalShoutrrr, "You are using the experimental shoutrrr support added in version 1.12.0") //nolint:lll m.EXPECT().Noticef(pp.EmojiUserError, `Could not create shoutrrr client: %v`, gomock.Any()) }, }, @@ -82,7 +87,9 @@ func TestReadAndAppendShoutrrrURL(t *testing.T) { require.Equal(t, []string{"Generic", "Pushover"}, s.ServiceDescriptions) }, true, - nil, + func(m *mocks.MockPP) { + m.EXPECT().Hintf(pp.HintExperimentalShoutrrr, "You are using the experimental shoutrrr support added in version 1.12.0") //nolint:lll + }, }, } { t.Run(name, func(t *testing.T) { diff --git a/internal/config/env_provider.go b/internal/config/env_provider.go index f271d231..807c0fa2 100644 --- a/internal/config/env_provider.go +++ b/internal/config/env_provider.go @@ -122,6 +122,9 @@ func ReadProvider(ppfmt pp.PP, key, keyDeprecated string, field *provider.Provid ) return false } + ppfmt.Hintf(pp.HintExperimentalLocalWithInterface, + `You are using the experimental provider "local:%s" added in version 1.15.0`, + parts[1]) *field = provider.NewLocalWithInterface(parts[1]) return true case len(parts) == 2 && parts[0] == "url": diff --git a/internal/config/env_provider_test.go b/internal/config/env_provider_test.go index 4a230064..63839dcf 100644 --- a/internal/config/env_provider_test.go +++ b/internal/config/env_provider_test.go @@ -155,7 +155,12 @@ func TestReadProvider(t *testing.T) { "cloudflare.doh": {true, " \tcloudflare.doh ", false, "", none, doh, true, nil}, "none": {true, " none ", false, "", trace, none, true, nil}, "local": {true, " local ", false, "", trace, local, true, nil}, - "local:lo": {true, " local : lo ", false, "", trace, localLoopback, true, nil}, + "local:lo": { + true, " local : lo ", false, "", trace, localLoopback, true, + func(m *mocks.MockPP) { + m.EXPECT().Hintf(pp.HintExperimentalLocalWithInterface, `You are using the experimental provider "local:%s" added in version 1.15.0`, "lo") //nolint:lll + }, + }, "local:": { true, " local: ", false, "", trace, trace, false, func(m *mocks.MockPP) { diff --git a/internal/config/env_waf.go b/internal/config/env_waf.go index 2ad4aab7..14d79ff6 100644 --- a/internal/config/env_waf.go +++ b/internal/config/env_waf.go @@ -27,6 +27,9 @@ func ReadAndAppendWAFListNames(ppfmt pp.PP, key string, field *[]api.WAFList) bo return true } + ppfmt.Hintf(pp.HintExperimentalWAF, + "You're using the new WAF list manipulation feature added in version 1.14.0") + lists := make([]api.WAFList, 0, len(vals)) for _, val := range vals { diff --git a/internal/config/env_waf_test.go b/internal/config/env_waf_test.go index a9f6e82f..372d96de 100644 --- a/internal/config/env_waf_test.go +++ b/internal/config/env_waf_test.go @@ -35,14 +35,20 @@ func TestReadAndAppendWAFListNames(t *testing.T) { nil, []api.WAFList{{AccountID: "hey", Name: "hello"}}, true, - nil, + func(m *mocks.MockPP) { + m.EXPECT().Hintf(pp.HintExperimentalWAF, + "You're using the new WAF list manipulation feature added in version 1.14.0") + }, }, "two": { true, "hey/hello,here/aloha", nil, []api.WAFList{{AccountID: "hey", Name: "hello"}, {AccountID: "here", Name: "aloha"}}, true, - nil, + func(m *mocks.MockPP) { + m.EXPECT().Hintf(pp.HintExperimentalWAF, + "You're using the new WAF list manipulation feature added in version 1.14.0") + }, }, "one+two": { true, "hey/hello,here/aloha", @@ -53,7 +59,10 @@ func TestReadAndAppendWAFListNames(t *testing.T) { {AccountID: "here", Name: "aloha"}, }, true, - nil, + func(m *mocks.MockPP) { + m.EXPECT().Hintf(pp.HintExperimentalWAF, + "You're using the new WAF list manipulation feature added in version 1.14.0") + }, }, "invalid-format": { true, "+++", @@ -61,6 +70,8 @@ func TestReadAndAppendWAFListNames(t *testing.T) { []api.WAFList{{AccountID: "there", Name: "ciao"}}, false, func(m *mocks.MockPP) { + m.EXPECT().Hintf(pp.HintExperimentalWAF, + "You're using the new WAF list manipulation feature added in version 1.14.0") m.EXPECT().Noticef(pp.EmojiUserError, `List %q should be in format "account-id/list-name"`, "+++") }, }, @@ -75,6 +86,8 @@ func TestReadAndAppendWAFListNames(t *testing.T) { }, true, func(m *mocks.MockPP) { + m.EXPECT().Hintf(pp.HintExperimentalWAF, + "You're using the new WAF list manipulation feature added in version 1.14.0") m.EXPECT().Noticef(pp.EmojiUserWarning, "List name %q contains invalid character %q", "!!!", "!") }, }, diff --git a/internal/pp/hint.go b/internal/pp/hint.go index fb7d957a..bd533b3a 100644 --- a/internal/pp/hint.go +++ b/internal/pp/hint.go @@ -16,4 +16,7 @@ const ( HintMismatchedRecordAttributes HintMismatchedWAFListAttributes Hint1111Blockage + HintExperimentalShoutrrr // introduced in 1.12.0 + HintExperimentalWAF // introduced in 1.14.0 + HintExperimentalLocalWithInterface // introduced in 1.15.0 )