Skip to content

Commit 673d14b

Browse files
committed
accept key from env var
1 parent 5b9b25b commit 673d14b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

main.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ type autocertCache struct {
211211
value string
212212
}
213213

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

0 commit comments

Comments
 (0)