One change I recommend (after some experimentation) it would be better to use individual flags for creds, something like --gdbuser neo4j --gdbpass s3cr3t
The reason being, viper will pull out everything it needs for all three approaches with GetString as we can load the CLI flags via BindPFlags alongside the env, and config values, all into the same shared space.
If we try to stay with --creds user:pass it makes it a lot more of a messy approach as the CLI args need separate verification and you need to play around with string slicing.
This change would get us in the position where we can then easily use a secrets system to inject log4j credentials via an env.
Let me know, hopefully you're not to adamant is has to be user:pass 😛
I am happy to work on this, already have most of the code locally.
+1 on this - this will be a nice improvement to management of instances once the Pub/sub (NATS) stuff that @pxp928 has been working on gets done and we setup the pipeline as well!
Introduce a viper config.
This way users can set args via a config file, CLI args and/or environment variables.
Environment variables:
export guac-db-addr=neo4j://localhost:7687
One change I recommend (after some experimentation) it would be better to use individual flags for creds, something like
--gdbuser neo4j --gdbpass s3cr3t
The reason being, viper will pull out everything it needs for all three approaches with
GetString
as we can load the CLI flags viaBindPFlags
alongside the env, and config values, all into the same shared space.If we try to stay with
--creds user:pass
it makes it a lot more of a messy approach as the CLI args need separate verification and you need to play around with string slicing.This change would get us in the position where we can then easily use a secrets system to inject log4j credentials via an env.
Let me know, hopefully you're not to adamant is has to be user:pass 😛
I am happy to work on this, already have most of the code locally.