{ "info": { "author": "Andrew O'Hara", "author_email": "andrew@andrewohara.io", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6" ], "description": "serverless-config\n=================\n\n.. image:: https://img.shields.io/pypi/status/serverless-config.svg\n :target: https://pypi.org/project/serverless-config\n\n.. image:: https://travis-ci.org/oharaandrew314/serverless-config.svg?branch=master\n :target: https://travis-ci.org/oharaandrew314/serverless-config\n \n.. image:: https://img.shields.io/pypi/v/serverless-config.svg\n :target: https://pypi.org/project/serverless-config\n\n.. image:: https://img.shields.io/pypi/l/serverless-config.svg\n :target: https://pypi.org/project/serverless-config\n\n.. image:: https://img.shields.io/pypi/pyversions/serverless-config.svg\n :target: https://pypi.org/serverless-config\n \n.. image:: https://codecov.io/github/oharaandrew314/serverless-config/coverage.svg?branch=master\n :target: https://codecov.io/github/oharaandrew314/serverless-config\n :alt: codecov.io\n\nA simple configuration client for AWS serverless Python systems.\n\nThere is also a `jvm version `_.\n\nInstallation\n------------\n\n.. code-block:: bash\n\n pip install serverless-config\n\nor\n\n.. code-block:: bash\n\n pipenv install serverless-config\n\nAWS lambda includes *boto3* in its environment, so *serverless-config* does not include it as a dependency in order to decrease the deployment package size.\nIf you wish to use *serverless-config* locally, be sure to install *boto3* as well.\n\n\nQuickstart\n----------\n\n.. code-block:: python\n\n from serverless_config import default_config\n config = default_config()\n\n string_prop = config.get_str('string_prop')\n int_prop = config.get_int('missing_int_prop', default_value=123)\n secret_prop = config.get_str('secret_prop', WithDecryption=True)\n\nThe default config will search for a parameter with the following order of precedence: **System Environment**, **AWS SSM Parameter Store**. You can learn more about them below.\n\nSupported Config Sources\n------------------------\n\nSystem Environment\n~~~~~~~~~~~~~~~~~~\n\nThe System environment is a good place to store microservice-specific parameters. They are set on the lambda function itself.\n\n.. code-block:: python\n\n from serverless_config import EnvConfig\n config = EnvConfig()\n config.get_str('string_prop')\n\nAWS SSM Parameter Store\n~~~~~~~~~~~~~~~~~~~~~~~\n\nSSM is perfect for storing parameters that are shared across microservices, and for storing encrypted secrets. It is fully managed, and does not require any configuration to get started.\n\n**Note**: the IAM role requires the `AmazonSSMReadOnlyAccess` policy to get properties from SSM.\n\n.. code-block:: python\n\n from serverless_config import SsmConfig\n config = SsmConfig()\n config.get_str('string_prop')\n\nA secret can optionally be decrypted in transit. That way, you do not need to worry about configuring your IAM role for access to the KMS Key.\n\n.. code-block:: python\n\n from serverless_config import SsmConfig\n config = SsmConfig()\n config.get_str('string_prop', WithDecryption=True)\n\n\nComposite Configs\n~~~~~~~~~~~~~~~~~\n\nThe **default_config** will first search in the **system environment**. If the parameter is not there, then it will search in **AWS SSM**.\n\n.. code-block:: python\n\n from serverless_config import default_config\n config = default_config()\n\nCustom Configs\n~~~~~~~~~~~~~~\n\nYou can even implement your own custom configs and composite configs!\n\n.. code-block:: python\n\n from serverless_config import ConfigBase, CompositeConfig, EnvConfig\n\n class DictConfig(ConfigBase):\n\n def __init__(self, prop_dict):\n self.prop_dict = prop_dict\n\n def get_str(prop_name, default_value=None):\n if prop_name in self.prop_dict:\n return self.prop_dict[prop_name]\n elif default_value:\n return default_value\n\n # You must raise a ValueError if the property is not found\n raise ValueError('Property not found: ' + prop_name)\n\n # You can make a standalone custom config\n props = dict(foo='bar', toll='troll')\n map_config = DictConfig(props)\n\n # And you can make a custom composite config with your new config\n custom_config = CompositeConfig(map_config, EnvConfig())\n \nCaching\n-------\n\nThe **default_config** will cache properties for 5 minutes. If you wish to use a specific or custom config, you can wrap the **CachedConfig** around it.\n\n.. code-block:: python\n\n from serverless_config import default_config\n \n config = default_config()\n value = config.get_str('prop') # getting value from env and ssm\n value = config.get_str('prop') # getting cached value\n \n.. code-block:: python\n\n from datetime import timedelta\n from serverless_config import EnvConfig, SsmConfig, CachedConfig, CompositeConfig\n \n CachedConfig(SsmConfig()) # config with default 5 minute cache duration\n CachedConfig(SsmConfig(), timedelta(hours=1) # config with 1 hour cache duration\n CachedConfig(CompositeConfig(SsmConfig(), EnvConfig())) # you can even cache a composite config!", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/oharaandrew314/serverless-config/", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "serverless-config", "package_url": "https://pypi.org/project/serverless-config/", "platform": "", "project_url": "https://pypi.org/project/serverless-config/", "project_urls": { "Homepage": "https://github.com/oharaandrew314/serverless-config/" }, "release_url": "https://pypi.org/project/serverless-config/0.3.1/", "requires_dist": null, "requires_python": "", "summary": "A configuration client for AWS serverless Python systems", "version": "0.3.1" }, "last_serial": 3321187, "releases": { "0.1.5.dev4": [ { "comment_text": "", "digests": { "md5": "043142ee0de1f20ded0e22bd0db4314e", "sha256": "1ed0fc12026df460fab65403d26948ae26367a7b61629118f547a8b464782cb7" }, "downloads": -1, "filename": "serverless_config-0.1.5.dev4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "043142ee0de1f20ded0e22bd0db4314e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6872, "upload_time": "2017-10-22T03:30:02", "url": "https://files.pythonhosted.org/packages/83/d9/c4367ecb9b4237ebd04a4cc8987ac82345352fd700f4ca438859ba53d222/serverless_config-0.1.5.dev4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "41aceae5911a8edcff34758103599c9f", "sha256": "da02afb65394b291f648b35d0d80e66f4ccfaa66cd3bfddd49dfd36ad267e2ce" }, "downloads": -1, "filename": "serverless-config-0.1.5.dev4.tar.gz", "has_sig": false, "md5_digest": "41aceae5911a8edcff34758103599c9f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4065, "upload_time": "2017-10-22T03:45:09", "url": "https://files.pythonhosted.org/packages/80/9f/0345229cfc24c1208ea6b11f3e8e8063fca11926d8b8bac0378d26e26022/serverless-config-0.1.5.dev4.tar.gz" } ], "0.1.5.dev5": [ { "comment_text": "", "digests": { "md5": "71095e20e81f20793967162609a3a282", "sha256": "8f894172f38551cb2655684bffea778acb1d89b793f10bb304f234936ba9e0f2" }, "downloads": -1, "filename": "serverless-config-0.1.5.dev5.tar.gz", "has_sig": false, "md5_digest": "71095e20e81f20793967162609a3a282", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4243, "upload_time": "2017-10-22T03:56:18", "url": "https://files.pythonhosted.org/packages/4e/a3/676cc9eff97c3106bf0a1ac9ca86ac38981183646ff6cc27d5bb188144b6/serverless-config-0.1.5.dev5.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "334e2d2e7cb3bd44bd5ffc4270362d0c", "sha256": "c1713307a6dc5f7fe1af48b018368496699c6b742704107e72857863ba05c060" }, "downloads": -1, "filename": "serverless-config-0.2.0.tar.gz", "has_sig": false, "md5_digest": "334e2d2e7cb3bd44bd5ffc4270362d0c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4208, "upload_time": "2017-10-22T04:44:18", "url": "https://files.pythonhosted.org/packages/a1/31/c3e2787a1889e8c421ddec5c712672926936ee045d32fbd420c319b74482/serverless-config-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "af2a074c3100e85c5b5486b8f49fba35", "sha256": "6cb79f8f821ea26dc04071453d81920c53771de41680a65c44727973e5701fea" }, "downloads": -1, "filename": "serverless-config-0.2.1.tar.gz", "has_sig": false, "md5_digest": "af2a074c3100e85c5b5486b8f49fba35", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4511, "upload_time": "2017-10-22T05:17:54", "url": "https://files.pythonhosted.org/packages/78/67/1015e0c0985f28f43dab4dcec9699bc139b78ab8a51851dace82785aeae5/serverless-config-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "c4d041fed055a7fa50dc167b07ee66dd", "sha256": "0b644cb1eb6fc3ba062273b49744d55c4cc51bc4ccddbf289c9b1cade9468f1f" }, "downloads": -1, "filename": "serverless-config-0.2.2.tar.gz", "has_sig": false, "md5_digest": "c4d041fed055a7fa50dc167b07ee66dd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4562, "upload_time": "2017-11-04T19:26:32", "url": "https://files.pythonhosted.org/packages/a3/eb/dd1f8069430e9a01cb23afaae8b74d4592e41ae9796b01f9867e9658d033/serverless-config-0.2.2.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "fd62cf1d341fddb616294ad50687dbe9", "sha256": "cdcbf8d809386eda0034189591cfba40fa82ee0127843bc66e50d424ff3e760e" }, "downloads": -1, "filename": "serverless-config-0.3.0.tar.gz", "has_sig": false, "md5_digest": "fd62cf1d341fddb616294ad50687dbe9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5106, "upload_time": "2017-11-10T03:22:19", "url": "https://files.pythonhosted.org/packages/4d/dd/fe10d035451d3fc20f0d13334ee789b93e7b5a63dea802e5fcd56580f307/serverless-config-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "b744290657d0671b523e5a0170c13a5b", "sha256": "1e202e9312ff02811c56538eab56b91c6801685c1053c0cde85069bc179533c5" }, "downloads": -1, "filename": "serverless-config-0.3.1.tar.gz", "has_sig": false, "md5_digest": "b744290657d0671b523e5a0170c13a5b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5111, "upload_time": "2017-11-10T03:29:49", "url": "https://files.pythonhosted.org/packages/3b/af/a39146e3b7b3ac1504cc706715054186e242b9d855cd2fa67da3295ba5e3/serverless-config-0.3.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b744290657d0671b523e5a0170c13a5b", "sha256": "1e202e9312ff02811c56538eab56b91c6801685c1053c0cde85069bc179533c5" }, "downloads": -1, "filename": "serverless-config-0.3.1.tar.gz", "has_sig": false, "md5_digest": "b744290657d0671b523e5a0170c13a5b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5111, "upload_time": "2017-11-10T03:29:49", "url": "https://files.pythonhosted.org/packages/3b/af/a39146e3b7b3ac1504cc706715054186e242b9d855cd2fa67da3295ba5e3/serverless-config-0.3.1.tar.gz" } ] }