Skip to content

Commit f65df87

Browse files
committed
refactor: allow root domain app urls for testing
1 parent 0e4d8c6 commit f65df87

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ BIN_NAME := tinyauth-$(GOARCH)
1313
DEV_COMPOSE := $(shell test -f "docker-compose.test.yml" && echo "docker-compose.test.yml" || echo "docker-compose.dev.yml" )
1414
PROD_COMPOSE := $(shell test -f "docker-compose.test.prod.yml" && echo "docker-compose.test.prod.yml" || echo "docker-compose.example.yml" )
1515

16+
.DEFAULT_GOAL := binary
17+
1618
# Deps
1719
deps:
1820
bun install --cwd frontend

internal/utils/app_utils.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"strings"
99

1010
"github.com/steveiliop56/tinyauth/internal/config"
11+
"github.com/steveiliop56/tinyauth/internal/utils/tlog"
1112

1213
"github.com/gin-gonic/gin"
1314
"github.com/weppos/publicsuffix-go/publicsuffix"
@@ -28,6 +29,11 @@ func GetCookieDomain(u string) (string, error) {
2829

2930
parts := strings.Split(host, ".")
3031

32+
if len(parts) == 2 {
33+
tlog.App.Warn().Msgf("Running on the root domain, cookies will be set for .%v", host)
34+
return host, nil
35+
}
36+
3137
if len(parts) < 3 {
3238
return "", errors.New("invalid app url, must be at least second level domain")
3339
}

0 commit comments

Comments
 (0)