Commit 02eacb8e authored by Francois's avatar Francois

Update config.go

parent 2a4459b9
......@@ -19,6 +19,7 @@ var (
AppConfigPath string
StaticDir map[string]string
TemplateCache map[string]*template.Template
StaticExtensionsToGzip []string //Files which should also be compressed with gzip (.js, .css, etc)
HttpAddr string
HttpPort int
HttpTLS bool
......@@ -68,6 +69,8 @@ func init() {
StaticDir = make(map[string]string)
StaticDir["/static"] = "static"
StaticExtensionsToGzip = []string{".css", ".js"}
TemplateCache = make(map[string]*template.Template)
......@@ -273,6 +276,23 @@ func ParseConfig() (err error) {
}
}
}
if sgz := AppConfig.String("StaticExtensionsToGzip"); sgz != "" {
extensions := strings.Split(sgz, ",")
if len(extensions) > 0 {
StaticExtensionsToGzip = []string{}
for _, ext := range extensions {
if len(ext) == 0 {
continue
}
extWithDot := ext
if extWithDot[:1] != "." {
extWithDot = "." + extWithDot
}
StaticExtensionsToGzip = append(StaticExtensionsToGzip, extWithDot)
}
}
}
if enableadmin, err := AppConfig.Bool("EnableAdmin"); err == nil {
EnableAdmin = enableadmin
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment