-
Notifications
You must be signed in to change notification settings - Fork 517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Aca-py startup arg updates #739
Aca-py startup arg updates #739
Conversation
Signed-off-by: Ian Costanzo <[email protected]>
Signed-off-by: Ian Costanzo <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Codecov Report
@@ Coverage Diff @@
## master #739 +/- ##
==========================================
- Coverage 99.01% 98.99% -0.03%
==========================================
Files 256 256
Lines 13956 13975 +19
==========================================
+ Hits 13819 13835 +16
- Misses 137 140 +3 |
Hmmm... -0.03% takes us below 99%. That's sad... |
Note that configargparse is pointing to my fork (in requirements.txt) pending them accepting my PR |
Signed-off-by: Ian Costanzo <[email protected]>
Signed-off-by: Ian Costanzo <[email protected]>
…s wallet Signed-off-by: Ian Costanzo <[email protected]>
Signed-off-by: Ian Costanzo <[email protected]>
Signed-off-by: Ian Costanzo <[email protected]>
Some discussion around environment variables - the "ConfigArgParse" library adds support for env vars, but they must be configured per parameter, like for example:
If the environment variable is present the value gets used, regardless of whether there is a config file or not. However you cannot substitute env vars in the config file, like the following:
The list of available environment variables (from the parser.add_argument() functions) is included in the usage() ("aca-py -h"), like: --wallet-rekey |
Signed-off-by: Ian Costanzo <[email protected]>
IMHO - this is even better. We get DRY documentation, we tightly tie the environment variables to the arguments. It does change how we have to environment variables, but the change looks like it moves us in the right direction. Ideal to use this always. Next challenge -- being able to use argparse as defined here in bash scripts :-) -- that would be awesome... |
It's not perfect - it would be nice to have the param substitution within the config file as well. For example multi-value parameters (like "input-transport", which is also a multi-instance parameter = multi instances of multi values) would be confusing to jam into a single environment variable. |
Except there is a very clear rule on how to do it, with usage information that makes it precise. What we are doing now is mixing and matching approaches that vary from variable to variable. Neither is perfect, but I would lean to consistency. But my vote doesn't count much (and rightly so :-) ) in these decisions. |
Env vars configured for: --admin-api-key: ACAPY_ADMIN_API_KEY |
Additional settings that we will likely need an environment variables for: If it was possible to use an environment variable to drive whether the agent starts in insecure mode or uses an api-key it would be good, but maybe out of scope now (this could also be tied to whether the admin interface is activated or not - I can't think of a use for an agent that has no admin interface). In general I would think having environment variables for all - or at least as many as possible - of the settings would be a good idea, both for consistency and especially when working with cloud deployments of any kind, where they are the easiest way to deal with configurations. At the same time, I realize that some of the environment variables (see the api-key/admin interface example above) would potentially force us to build additional logic to check whether other environment variables are set based on their value. This is a bigger job than we maybe willing to do now, but will definitely make the agents more user-friendly and resilient. |
Signed-off-by: Ian Costanzo <[email protected]>
Signed-off-by: Ian Costanzo <[email protected]>
Added |
Codecov Report
@@ Coverage Diff @@
## master #739 +/- ##
=========================================
Coverage ? 98.99%
=========================================
Files ? 256
Lines ? 13975
Branches ? 0
=========================================
Hits ? 13835
Misses ? 140
Partials ? 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks @ianco
py_multicodec==0.2.1 | ||
git+https://github.com/ianco/ConfigArgParse.git#egg=ConfigArgParse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we log an issue to remember updating this dependency, when you PR is merged?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Make "--endpoint" required. Make genesis required (url, file or txns) unless "--no-ledger" is specified. Make some "indy" wallet parameters required (name, key, etc) if indy wallet type is specified.
Added "--arg-file " to allow params to be included in a file. (File is just a list of args, not structured with yml etc) Had to change some related logic - couldn't flag args as "required" so moved the check to the "get_settings()" method and threw "ArgsParseError"; display usage on any ArgsParseError. (Had to fix a couple of unit tests that expected the "old" behaviour.
Related to issue #521