apply geoip2, config file.

This commit is contained in:
dalbodeule
2025-10-14 13:02:39 +09:00
parent c55d3eda4f
commit 44e4446bf0
7 changed files with 159 additions and 13 deletions

32
utils/config.go Normal file
View File

@@ -0,0 +1,32 @@
package utils
import (
"log"
"os"
"strings"
"github.com/joho/godotenv"
)
type Config struct {
Port string
Geoip string
CountryBlacklist []string
}
func GetConfig() *Config {
err := godotenv.Load()
if err != nil {
log.Fatal("Error loading .env file")
}
port := os.Getenv("PORT")
geoip_dbfile := os.Getenv("GEOIP_DB")
country_blacklist := os.Getenv("COUNTRY_BLACKLIST")
return &Config{
Port: port,
Geoip: geoip_dbfile,
CountryBlacklist: strings.Split(country_blacklist, ","),
}
}