From 753df6e133f4d1658ccf8970176f6c6540c46071 Mon Sep 17 00:00:00 2001 From: Lukasz Raczylo Date: Mon, 10 Jun 2024 23:46:44 +0100 Subject: [PATCH] fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Update dependencies. --- main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 0e6bde5..a9cbd5d 100644 --- a/main.go +++ b/main.go @@ -4,6 +4,7 @@ import ( "flag" "os" "strings" + "sync" "github.com/gofiber/fiber/v2/middleware/proxy" "github.com/gookit/goutil/envutil" @@ -13,6 +14,7 @@ import ( ) var cfg *config +var once sync.Once // function get value from the env where the value can be anything func getDetailsFromEnv[T any](key string, defaultValue T) T { @@ -79,7 +81,9 @@ func parseConfig() { enableCache() // takes close to no resources, but can be used with dynamic query cache loadRatelimitConfig() - go enableApi() + once.Do(func() { + go enableApi() + }) prepareQueriesAndExemptions() }