First commit

This commit is contained in:
corrado.mulas
2024-11-20 00:46:54 +01:00
parent 1e9cb5ffc4
commit 68de7bf0b1

View File

@@ -3,9 +3,12 @@ package main
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"log"
"net/http" "net/http"
"os" "os"
"strings" "strings"
"github.com/joho/godotenv"
) )
// RegistrationRequest represents the incoming registration request. // RegistrationRequest represents the incoming registration request.
@@ -100,3 +103,18 @@ func validateEmailDomain(email string) bool {
} }
return false return false
} }
func validateEnvVars(vars []string) error {
for _, v := range vars {
if os.Getenv(v) == "" {
return fmt.Errorf("environment variable %s is not set", v)
}
}
return nil
}
func loadEnv() {
if err := godotenv.Load(); err != nil {
log.Println("No .env file found, using system environment variables")
}
}