From 5d14a4f7e4af41135639f25635e4703e9fe86091 Mon Sep 17 00:00:00 2001 From: Quinten <67589015+QuintenQVD0@users.noreply.github.com> Date: Sun, 18 Feb 2024 17:57:58 +0100 Subject: [PATCH] functions do not belong in main --- main.go | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/main.go b/main.go index c59866d..b756002 100644 --- a/main.go +++ b/main.go @@ -52,16 +52,7 @@ func main() { // Add more validation rules as needed } - func getIPAddressKey() string { - // Check if PUBLIC_IP environment variable exists and is not empty - val, ok := os.LookupEnv("PUBLIC_IP") - if ok && val != "" { - return "PUBLIC_IP" - } - - // Fallback to SERVER_IP if PUBLIC_IP is empty or does not exist - return "SERVER_IP" - } + // Read environment variables envVars := map[string]string{ @@ -377,3 +368,14 @@ func copyFile(src, dst string) error { } return ioutil.WriteFile(dst, data, 0644) } + +func getIPAddressKey() string { + // Check if PUBLIC_IP environment variable exists and is not empty + val, ok := os.LookupEnv("PUBLIC_IP") + if ok && val != "" { + return "PUBLIC_IP" + } + + // Fallback to SERVER_IP if PUBLIC_IP is empty or does not exist + return "SERVER_IP" +} \ No newline at end of file