From e05c3a06ae72fb96244c5ed9d14c3de72881aba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Z=C3=BCrcher?= Date: Sat, 31 Jan 2026 20:37:03 +0100 Subject: [PATCH] some changes --- env/enviroment.go | 6 +++++- handlers/infos.go | 11 +---------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/env/enviroment.go b/env/enviroment.go index 5564244..d81fb5c 100644 --- a/env/enviroment.go +++ b/env/enviroment.go @@ -26,7 +26,11 @@ func Load(path string) error { } func (key EnvKey) GetValue() string { - return os.Getenv(string(key)) + port := os.Getenv(string(key)) + if port == "" { + port = "8080" + } + return port } func (key EnvKey) SetValue(value string) { diff --git a/handlers/infos.go b/handlers/infos.go index 4062ebb..3b28a4f 100644 --- a/handlers/infos.go +++ b/handlers/infos.go @@ -35,19 +35,10 @@ func getActiveIP() string { func InfoHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") - port := env.Port.GetValue() - if port == "" { - port = "8080" - } - - speed := env.IntervalDefault.GetValue() - if speed == "" { - speed = "10" - } data := map[string]string{ "ip": GetLocalIP(), - "port": port, + "port": env.Port.GetValue(), "speed": GetInterval(), } err := json.NewEncoder(w).Encode(data)