feat: read env for TLS to set schemas for assets/css

This commit is contained in:
HeshamTB 2023-09-13 11:32:47 +03:00
parent bcd8c1333d
commit 857c4ed001

View File

@ -5,6 +5,7 @@ import (
"html/template" "html/template"
"log" "log"
"net/http" "net/http"
"os"
"time" "time"
) )
@ -94,6 +95,12 @@ type Context struct {
} }
func NewContext(r *http.Request) *Context { func NewContext(r *http.Request) *Context {
isTLS := false
tls := os.Getenv("TLS")
if tls != "" {
isTLS = true
}
return &Context{ return &Context{
request: r, request: r,
StatusCode: 200, StatusCode: 200,
@ -105,7 +112,7 @@ func NewContext(r *http.Request) *Context {
}, },
}, },
AppURL: r.Host, AppURL: r.Host,
IsTLS: false, IsTLS: isTLS,
} }
} }