Last active
December 17, 2020 01:41
-
-
Save mkaranasou/0eeeae1b65c4e50448f03fec79c826d1 to your computer and use it in GitHub Desktop.
Example of using parse_config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To run this: | |
# export DB_PASS=very_secret_and_complex | |
# python use_env_variables_in_config_example.py -c /path/to/yaml | |
# do stuff with conf, e.g. access the database password like this: conf['database']['DB_PASS'] | |
if __name__ == '__main__': | |
parser = argparse.ArgumentParser(description='My awesome script') | |
parser.add_argument( | |
"-c", "--conf", action="store", dest="conf_file", | |
help="Path to config file" | |
) | |
args = parser.parse_args() | |
conf = parse_config(path=args.conf_file) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment