Skip to content

Commit

Permalink
accept key from env var
Browse files Browse the repository at this point in the history
  • Loading branch information
Snawoot committed Dec 25, 2024
1 parent 5b9b25b commit 673d14b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ type autocertCache struct {
value string
}

const envCacheEncKey = "DUMBPROXY_CACHE_ENC_KEY"

type CLIArgs struct {
bindAddress string
bindReusePort bool
Expand Down Expand Up @@ -275,6 +277,7 @@ func parse_args() CLIArgs {
value: filepath.Join(home, ".dumbproxy", "autocert"),
},
}
args.autocertCacheEncKey.Set(os.Getenv(envCacheEncKey))
flag.StringVar(&args.bindAddress, "bind-address", ":8080", "HTTP proxy listen address. Set empty value to use systemd socket activation.")
flag.BoolVar(&args.bindReusePort, "bind-reuseport", false, "allow multiple server instances on the same port")
flag.StringVar(&args.bindPprof, "bind-pprof", "", "enables pprof debug endpoints")
Expand Down Expand Up @@ -312,7 +315,7 @@ func parse_args() CLIArgs {
return nil
})
flag.StringVar(&args.autocertCacheRedisPrefix, "autocert-cache-redis-prefix", "", "prefix to use for keys in Redis or Redis Cluster cache")
flag.Var(&args.autocertCacheEncKey, "autocert-cache-enc-key", "hex-encoded encryption key for cert cache entries")
flag.Var(&args.autocertCacheEncKey, "autocert-cache-enc-key", "hex-encoded encryption key for cert cache entries. Can be also set with "+envCacheEncKey+" environment variable")
flag.StringVar(&args.autocertACME, "autocert-acme", autocert.DefaultACMEDirectory, "custom ACME endpoint")
flag.StringVar(&args.autocertEmail, "autocert-email", "", "email used for ACME registration")
flag.StringVar(&args.autocertHTTP, "autocert-http", "", "listen address for HTTP-01 challenges handler of ACME")
Expand Down

0 comments on commit 673d14b

Please sign in to comment.