mirror of
https://github.com/ssep1ol/overleaf-registration-be.git
synced 2026-07-21 20:40:21 +00:00
First commit
This commit is contained in:
18
handlers.go
18
handlers.go
@@ -3,9 +3,12 @@ package main
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/joho/godotenv"
|
||||
)
|
||||
|
||||
// RegistrationRequest represents the incoming registration request.
|
||||
@@ -100,3 +103,18 @@ func validateEmailDomain(email string) bool {
|
||||
}
|
||||
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")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user