mirror of
https://github.com/Luzifer/staticmap.git
synced 2024-12-20 12:51:18 +00:00
Allow configuration through ENV
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
93d32ebb28
commit
16df82417f
1 changed files with 5 additions and 5 deletions
10
main.go
10
main.go
|
@ -21,11 +21,11 @@ import (
|
|||
var (
|
||||
cfg struct {
|
||||
CacheDir string `flag:"cache-dir" default:"cache" env:"CACHE_DIR" description:"Directory to save the cached images to"`
|
||||
ForceCache time.Duration `flag:"force-cache" default:"24h" description:"Force map to be cached for this duration"`
|
||||
ForceCache time.Duration `flag:"force-cache" default:"24h" env:"FORCE_CACHE" description:"Force map to be cached for this duration"`
|
||||
Listen string `flag:"listen" default:":3000" description:"IP/Port to listen on"`
|
||||
MaxSize string `flag:"max-size" default:"1024x1024" description:"Maximum map size requestable"`
|
||||
RateLimit int64 `flag:"rate-limit" default:"1" description:"How many requests to allow per time"`
|
||||
RateLimitTime time.Duration `flag:"rate-limit-time" default:"1s" description:"Time interval to allow N requests in"`
|
||||
MaxSize string `flag:"max-size" default:"1024x1024" env:"MAX_SIZE" description:"Maximum map size requestable"`
|
||||
RateLimit int64 `flag:"rate-limit" default:"1" env:"RATE_LIMIT" description:"How many requests to allow per time"`
|
||||
RateLimitTime time.Duration `flag:"rate-limit-time" default:"1s" env:"RATE_LIMIT_TIME" description:"Time interval to allow N requests in"`
|
||||
VersionAndExit bool `flag:"version" default:"false" description:"Print version information and exit"`
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ var (
|
|||
|
||||
func init() {
|
||||
var err error
|
||||
if err = rconfig.Parse(&cfg); err != nil {
|
||||
if err = rconfig.ParseAndValidate(&cfg); err != nil {
|
||||
log.Fatalf("Unable to parse CLI parameters")
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue