diff options
| author | mo khan <mo@mokhan.ca> | 2025-05-08 09:10:15 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-05-08 09:10:15 -0600 |
| commit | 49148ceb7ec082da18517b5ea334ffa50d80742c (patch) | |
| tree | e65c67b618117b08cd2919d58be9cb30e4cb00df /pkg/web/cookie.go | |
| parent | da5827c3c8f3ae0a30758deec9b3e86f009dd604 (diff) | |
fix: temporarily disable signed cookies in staging/production
Diffstat (limited to 'pkg/web/cookie.go')
| -rw-r--r-- | pkg/web/cookie.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/pkg/web/cookie.go b/pkg/web/cookie.go index d8ba658..5123bbe 100644 --- a/pkg/web/cookie.go +++ b/pkg/web/cookie.go @@ -32,6 +32,10 @@ func NewCookie(name, value string, options ...x.Option[*http.Cookie]) *http.Cook } func withSignedValue(value string) x.Option[*http.Cookie] { + if env.Fetch("APP_ENV", "development") == "production" { + return cookie.WithValue(value) + } + signature, err := Signer.Sign([]byte(value)) if err != nil { return cookie.WithValue(value) @@ -54,6 +58,10 @@ func ExpireCookie(w http.ResponseWriter, name string) { } func CookieValueFrom(c *http.Cookie) string { + if env.Fetch("APP_ENV", "development") == "production" { + return c.Value + } + segments := strings.SplitN(c.Value, delimiter, 2) if len(segments) != 2 { return "" |
