Skip to content

📚 The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

Remove FRONTEND_URL deprecated support

Smaug6739a2d530abdd69
diff --git a/backend/main.go b/backend/main.go
index 19b40816..fac09d8e 100644
--- a/backend/main.go
+++ b/backend/main.go
@@ -3,7 +3,6 @@ package main
import (
"alexandrie/pkg/logger"
"alexandrie/server"
- "alexandrie/utils"
"os"
"github.com/joho/godotenv"
@@ -14,7 +13,6 @@ func main() {
logger.Info("Initializing Alexandrie backend...")
godotenv.Load() // Load .env file if present
- utils.SetDomainEnv() // Set DOMAIN_CLIENT and DOMAIN_COOKIE from "FRONTEND_URL" if needed
port := os.Getenv("BACKEND_PORT")
if port == "" {
logger.Error("BACKEND_PORT environment variable not set")
diff --git a/backend/utils/README.md b/backend/utils/README.md
index e5c9f72a..5fdff353 100644
--- a/backend/utils/README.md
+++ b/backend/utils/README.md
@@ -66,24 +66,6 @@ safe := utils.EscapeHTML(input)
// Result: "<script>alert('xss')</script>"
```
-### Domain Utilities (`domains.go`)
-
-Manage application domains and environment variables.
-
-SetDomainEnv initializes DOMAIN_CLIENT and COOKIE_DOMAIN environment variables
-based on FRONTEND_URL (if defined).
-If FRONTEND_URL is not set, the function does nothing.
-
-**Examples:**
-
-FRONTEND_URL=https://alexandrie-hub.fr
--> DOMAIN_CLIENT=https://alexandrie-hub.fr
--> COOKIE_DOMAIN=alexandrie-hub.fr
-
-FRONTEND_URL=http://localhost:8200
--> DOMAIN_CLIENT=http://localhost:8200
--> COOKIE_DOMAIN=localhost
-
### Pointer Helpers (`pointers.go`)
Safely handle pointer conversions.
diff --git a/backend/utils/domains.go b/backend/utils/domains.go
deleted file mode 100644
index cdb06ca6..00000000
--- a/backend/utils/domains.go
+++ /dev/null
@@ -1,45 +0,0 @@
-package utils
-
-// Utility functions for domain and environment variable management
-
-import (
- "fmt"
- "net/url"
- "os"
- "strings"
-)
-
-// SetDomainEnv initializes DOMAIN_CLIENT and COOKIE_DOMAIN environment variables
-// based on FRONTEND_URL (if defined).
-// If FRONTEND_URL is not set, the function does nothing.
-//
-// Example:
-// FRONTEND_URL=https://alexandrie-hub.fr
-// -> DOMAIN_CLIENT=https://alexandrie-hub.fr
-// -> COOKIE_DOMAIN=alexandrie-hub.fr
-//
-// FRONTEND_URL=http://localhost:8200
-// -> DOMAIN_CLIENT=http://localhost:8200
-// -> COOKIE_DOMAIN=localhost
-func SetDomainEnv() {
- frontendURL := strings.TrimSpace(os.Getenv("FRONTEND_URL"))
- if frontendURL == "" {
- return
- }
-
- u, err := url.Parse(frontendURL)
- if err != nil || u.Host == "" {
- fmt.Fprintf(os.Stderr, "⚠️ Invalid FRONTEND_URL env variable: %s\n Expected format: http(s)://<host>[:port] \n > Example: https://alexandrie-hub.fr \n > Example: http://localhost:8200\n", frontendURL)
- os.Exit(1)
- }
-
- // Remove port for cookie domain if present
- host := u.Host
- if idx := strings.Index(host, ":"); idx != -1 {
- host = host[:idx]
- }
-
- // Set derived environment variables
- _ = os.Setenv("DOMAIN_CLIENT", fmt.Sprintf("%s://%s", u.Scheme, u.Host))
- _ = os.Setenv("COOKIE_DOMAIN", host)
-}