From 857c4ed00126353eaaaefe66966553b5fba50c24 Mon Sep 17 00:00:00 2001 From: HeshamTB Date: Wed, 13 Sep 2023 11:32:47 +0300 Subject: [PATCH] feat: read env for TLS to set schemas for assets/css --- main.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 0835842..0b7c707 100644 --- a/main.go +++ b/main.go @@ -5,6 +5,7 @@ import ( "html/template" "log" "net/http" + "os" "time" ) @@ -94,6 +95,12 @@ type Context struct { } func NewContext(r *http.Request) *Context { + isTLS := false + tls := os.Getenv("TLS") + if tls != "" { + isTLS = true + } + return &Context{ request: r, StatusCode: 200, @@ -105,7 +112,7 @@ func NewContext(r *http.Request) *Context { }, }, AppURL: r.Host, - IsTLS: false, + IsTLS: isTLS, } }