From 6a7b6a34d83d5765f8504be3359681555559c900 Mon Sep 17 00:00:00 2001 From: william-cass-wright Date: Thu, 23 Jun 2022 23:21:45 -0700 Subject: [PATCH] readme updates and config handler --- README.md | 17 ++++++++++------- secrets_mgmt_cli/config.py | 8 ++++++++ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 5d26b92..1bb58aa 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,17 @@ [![Tests](https://github.com/william-cass-wright/secrets-mgmt-cli/workflows/Test/badge.svg)](https://github.com/william-cass-wright/secrets-mgmt-cli/actions?query=workflow%3ATest) [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/william-cass-wright/secrets-mgmt-cli/blob/master/LICENSE) +## Summary + - A simple CLI for managing secrets in AWS Secrets Manager -- [PyPI project](https://pypi.org/project/secrets-mgmt-cli/) -- Based on cookiecutter template [simonw/click-app](https://github.com/simonw/click-app) +- [PyPI project][2] +- Based on the following projects: + - cookiecutter template [simonw/click-app][3] + - AWS code sample [secretsmanager_basics.py][1] + +[1]: https://docs.aws.amazon.com/code-samples/latest/catalog/python-secretsmanager-secretsmanager_basics.py.html +[2]: https://pypi.org/project/secrets-mgmt-cli/ +[3]: https://github.com/simonw/click-app ## Installation Install this tool using `pip`: @@ -40,8 +48,3 @@ To run the tests: ```bash pytest ``` - -## References -- heavily based on [secretsmanager_basics.py][1] - -[1]: https://docs.aws.amazon.com/code-samples/latest/catalog/python-secretsmanager-secretsmanager_basics.py.html diff --git a/secrets_mgmt_cli/config.py b/secrets_mgmt_cli/config.py index f31df41..a07d693 100644 --- a/secrets_mgmt_cli/config.py +++ b/secrets_mgmt_cli/config.py @@ -91,5 +91,13 @@ def formatted_print(self, key, val, n=20): val = str(val) print(key, (n - int(len(key))) * ".", val) + def get_configs(self): + if os.path.isfile(self.config_file_path): + return self.config.defaults() + else: + return None + + def check_config_exists(self): + return os.path.isfile(self.config_file_path) config_handler = ConfigHandler()