From f65df872f052e1c347326171b7a4c380d7249c83 Mon Sep 17 00:00:00 2001 From: Stavros Date: Sun, 29 Mar 2026 20:27:09 +0300 Subject: [PATCH] refactor: allow root domain app urls for testing --- Makefile | 2 ++ internal/utils/app_utils.go | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/Makefile b/Makefile index dfabc34..cecac21 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,8 @@ BIN_NAME := tinyauth-$(GOARCH) DEV_COMPOSE := $(shell test -f "docker-compose.test.yml" && echo "docker-compose.test.yml" || echo "docker-compose.dev.yml" ) PROD_COMPOSE := $(shell test -f "docker-compose.test.prod.yml" && echo "docker-compose.test.prod.yml" || echo "docker-compose.example.yml" ) +.DEFAULT_GOAL := binary + # Deps deps: bun install --cwd frontend diff --git a/internal/utils/app_utils.go b/internal/utils/app_utils.go index e36f4d8..c5055e3 100644 --- a/internal/utils/app_utils.go +++ b/internal/utils/app_utils.go @@ -8,6 +8,7 @@ import ( "strings" "github.com/steveiliop56/tinyauth/internal/config" + "github.com/steveiliop56/tinyauth/internal/utils/tlog" "github.com/gin-gonic/gin" "github.com/weppos/publicsuffix-go/publicsuffix" @@ -28,6 +29,11 @@ func GetCookieDomain(u string) (string, error) { parts := strings.Split(host, ".") + if len(parts) == 2 { + tlog.App.Warn().Msgf("Running on the root domain, cookies will be set for .%v", host) + return host, nil + } + if len(parts) < 3 { return "", errors.New("invalid app url, must be at least second level domain") }