ghostunnel icon indicating copy to clipboard operation
ghostunnel copied to clipboard

Configuration should be able to come from a file, environment variable, or command line argument

Open mcpherrinm opened this issue 6 years ago • 3 comments

In #249 / #250 we added support for environment variables for some configurables.

However, it might be nice to have a consistent and generalized way to configure Ghostunnel:

  1. Defaults from a config file (yaml or json, maybe)
  2. Override with Environment Variables
  3. Override with Command line flags

It might be easier to do this if we move from github.com/alecthomas/kingpin to github.com/alecthomas/kong, as it has some support for the "defaults in a config file".

mcpherrinm avatar Sep 03 '19 18:09 mcpherrinm

Some discussion in #253 about how configuration should be live-loadable (especially for ACLs, if not other config options too).

mcpherrinm avatar Sep 05 '19 04:09 mcpherrinm

In case somebody needs a temporal solution, I was looking at kingpin and it has an option to load args and flags from file, which I believe is not bad :man_shrugging: :

ibrahim@pc:~$ cat test_config

--listen=127.0.0.1:3333
--target=127.0.0.1:4444
--cacert=certstrap/bin/out/ca.crt
--keystore=certstrap/bin/out/org1.pem

ibrahim@pc:~$ ./ghostunnel client @test_config

[6327] 2019/09/09 09:58:57.527016 starting ghostunnel in client mode
[6327] 2019/09/09 09:58:57.527912 using target address 127.0.0.1:4444
[6327] 2019/09/09 09:58:57.528280 listening for connections on 127.0.0.1:3333

ibrahimmenem avatar Sep 09 '19 08:09 ibrahimmenem

TIL, that's actually super neat. I did not know this was possible. We should document that maybe, it could be useful for others.

csstaub avatar Sep 09 '19 20:09 csstaub