summaryrefslogtreecommitdiff
path: root/pkg/web/cookie.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/web/cookie.go')
-rw-r--r--pkg/web/cookie.go8
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 ""