mirror of
https://github.com/TecharoHQ/anubis.git
synced 2025-08-03 17:59:24 -04:00
chore(lib/policy): start the deprecation process for slow
This mostly adds a warning, but the "slow" method is in the process of being removed. Warn admins with slog.Warn. Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
parent
b4fe0db7f4
commit
3c42963c85
@ -149,6 +149,10 @@ func ParseConfig(ctx context.Context, fin io.Reader, fname string, defaultDiffic
|
|||||||
if parsedBot.Challenge.Algorithm == "" {
|
if parsedBot.Challenge.Algorithm == "" {
|
||||||
parsedBot.Challenge.Algorithm = config.DefaultAlgorithm
|
parsedBot.Challenge.Algorithm = config.DefaultAlgorithm
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if parsedBot.Challenge.Algorithm == "slow" {
|
||||||
|
slog.Warn("use of deprecated algorithm \"slow\" detected, please update this to \"fast\" when possible", "name", parsedBot.Name)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if b.Weight != nil {
|
if b.Weight != nil {
|
||||||
@ -163,6 +167,10 @@ func ParseConfig(ctx context.Context, fin io.Reader, fname string, defaultDiffic
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, t := range c.Thresholds {
|
for _, t := range c.Thresholds {
|
||||||
|
if t.Challenge != nil && t.Challenge.Algorithm == "slow" {
|
||||||
|
slog.Warn("use of deprecated algorithm \"slow\" detected, please update this to \"fast\" when possible", "name", t.Name)
|
||||||
|
}
|
||||||
|
|
||||||
if t.Name == "legacy-anubis-behaviour" && t.Expression.String() == "true" {
|
if t.Name == "legacy-anubis-behaviour" && t.Expression.String() == "true" {
|
||||||
if !warnedAboutThresholds.Load() {
|
if !warnedAboutThresholds.Load() {
|
||||||
slog.Warn("configuration file does not contain thresholds, see docs for details on how to upgrade", "fname", fname, "docs_url", "https://anubis.techaro.lol/docs/admin/configuration/thresholds/")
|
slog.Warn("configuration file does not contain thresholds, see docs for details on how to upgrade", "fname", fname, "docs_url", "https://anubis.techaro.lol/docs/admin/configuration/thresholds/")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user