blob: 3e0f1965c17794d9ddfd50d21796a175149a8933 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
package config
import (
"time"
)
// TODO: refactor config flags in main.go and find a better way to handle all settings
type Config struct {
zip *ZipServing
}
// DefaultConfig struct that can be accessed by different packages to share
// configuration parameters
var DefaultConfig = &Config{
// TODO: think of a way to not repeat these here and in main.go
zip: &ZipServing{
ExpirationInterval: time.Minute,
CleanupInterval: time.Minute / 2,
RefreshInterval: time.Minute / 2,
OpenTimeout: time.Minute / 2,
},
}
// ZipServing stores all configuration values to be used by the zip VFS opening and
// caching
type ZipServing struct {
ExpirationInterval time.Duration
CleanupInterval time.Duration
RefreshInterval time.Duration
OpenTimeout time.Duration
}
// SetZip config to the global config
func (c *Config) SetZip(zip *ZipServing) {
c.zip = zip
}
func (c *Config) GetZip() *ZipServing {
return c.zip
}
|