From 7c19febd7362a2e78146fb7c40baa54901703190 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Thu, 28 Dec 2017 20:34:18 -0800 Subject: Add configurable HTTPS flag for secure cookie flag --- config/config.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'config') diff --git a/config/config.go b/config/config.go index b1169e7..21076b1 100644 --- a/config/config.go +++ b/config/config.go @@ -26,7 +26,9 @@ const ( ) // Config manages configuration parameters. -type Config struct{} +type Config struct { + IsHTTPS bool +} // Get returns a config parameter value. func (c *Config) Get(key, fallback string) string { @@ -51,5 +53,5 @@ func (c *Config) GetInt(key string, fallback int) int { // NewConfig returns a new Config. func NewConfig() *Config { - return &Config{} + return &Config{IsHTTPS: os.Getenv("HTTPS") != ""} } -- cgit v1.2.3