add developer documentation and custom rate limiter with banning
All checks were successful
Build & Publish Docker Image / build-and-push (push) Successful in 46s

Add a comprehensive guide for developers transitioning from Node/PHP and implement a new middleware to handle IP-based rate limiting with temporary banning functionality. Also refactors configuration loading to use a singleton pattern for better resource management.
This commit is contained in:
Flavio Fois
2026-03-23 19:10:29 +01:00
parent be53f2ab47
commit 9cc0f3157c
6 changed files with 1064 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ import (
"os"
"strconv"
"strings"
"sync"
)
type Config struct {
@@ -17,7 +18,17 @@ type Config struct {
ConnMaxLifetime int
}
var (
instance *Config
once sync.Once
)
func Load() *Config {
once.Do(func() { instance = load() })
return instance
}
func load() *Config {
port := os.Getenv("PORT")
if port == "" {
port = "8080"