forked from vela-games/lfsproxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.go
29 lines (23 loc) · 908 Bytes
/
config.go
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
package config
import (
"time"
"github.com/kelseyhightower/envconfig"
)
type Config struct {
DebugMode bool `split_words:"true" default:"false"`
UpstreamBaseURL string `split_words:"true" required:"true"`
CacheEviction time.Duration `split_words:"true" default:"23h"`
S3Bucket string `split_words:"true" required:"true"`
S3UseAccelerate bool `split_words:"true" default:"false"`
S3PresignEnabled bool `split_words:"true" default:"true"`
S3PresignExpiration time.Duration `split_words:"true" default:"24h"`
EnablePrometheusExporter bool `split_words:"true" default:"false"`
}
func GetConfig() (*Config, error) {
var proxyConfiguration Config
err := envconfig.Process("app", &proxyConfiguration)
if err != nil {
return nil, err
}
return &proxyConfiguration, nil
}