Skip to content

Commit 4b2f116

Browse files
author
Luca Buzzi
committed
fixed issue with CacheDuration parsing from yml
1 parent 5b3bb7e commit 4b2f116

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

evo.config.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,22 +66,22 @@ type Configuration struct {
6666
} `yaml:"jwt"`
6767

6868
Server struct {
69-
Host string `yaml:"host"`
70-
Port string `yaml:"port"`
71-
Cert string `yaml:"cert"`
72-
Key string `yaml:"key"`
73-
HTTPS bool `yaml:"https"`
74-
Name string `yaml:"name"`
75-
MaxUploadSize string `yaml:"max-upload-size"`
76-
StrictRouting bool `yaml:"strict-routing"`
77-
CaseSensitive bool `yaml:"case-sensitive"`
78-
RequestID bool `yaml:"request-id"`
79-
Debug bool `yaml:"debug"`
80-
Recover bool `yaml:"recover"`
81-
ProxyHeader string `yaml:"proxy-header"`
82-
ReduceMemoryUsage bool `yaml:"reduce-memory-usage"`
83-
MaxAge int `yaml:"static-max-age"`
84-
CacheDuration time.Duration `yaml:"static-cache-duration"`
69+
Host string `yaml:"host"`
70+
Port string `yaml:"port"`
71+
Cert string `yaml:"cert"`
72+
Key string `yaml:"key"`
73+
HTTPS bool `yaml:"https"`
74+
Name string `yaml:"name"`
75+
MaxUploadSize string `yaml:"max-upload-size"`
76+
StrictRouting bool `yaml:"strict-routing"`
77+
CaseSensitive bool `yaml:"case-sensitive"`
78+
RequestID bool `yaml:"request-id"`
79+
Debug bool `yaml:"debug"`
80+
Recover bool `yaml:"recover"`
81+
ProxyHeader string `yaml:"proxy-header"`
82+
ReduceMemoryUsage bool `yaml:"reduce-memory-usage"`
83+
MaxAge int `yaml:"static-max-age"`
84+
CacheDuration string `yaml:"static-cache-duration"`
8585
} `yaml:"server"`
8686

8787
Database struct {

evo.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ func Run() {
134134
maxAge = defaultMaxAge
135135
}
136136

137-
cacheDuration := config.Server.CacheDuration
138-
if cacheDuration <= 0 {
137+
cacheDuration, parseErr := time.ParseDuration(config.Server.CacheDuration)
138+
if parseErr != nil {
139139
cacheDuration = defaultCacheDuration
140140
}
141141

0 commit comments

Comments
 (0)