Skip to content

Commit

Permalink
functions do not belong in main
Browse files Browse the repository at this point in the history
  • Loading branch information
QuintenQVD0 authored Feb 18, 2024
1 parent 5f69a6b commit 5d14a4f
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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"
}

0 comments on commit 5d14a4f

Please sign in to comment.