基于适配器的配置处理程序(支持env和awssm)。

blinkistconfig的Python项目详细描述


blinkist配置python

这个包简化了对不同配置存储的访问。当前支持的存储包括: env-从应用程序的环境变量读取 SSM-从AWS SSM参数存储读取

用法

环境

importblinkistconfig.Config# Setup the Config to use the ENV as config storeconfig=blinkistconfig.Config(env="development",app_name="my_nice_app",adapter_type="ENV")my_config_value=config.get("some/folder/config")# This is being translated to ENV["SOME_FOLDER_CONFIG"]

SSM

对于ssm,此工具模拟每个应用程序的命名空间/目录功能 有自己的。默认情况下,在应用程序中请求参数myparam1 调用my_nice_app将查询ssm参数存储/application/my_nice_app/myparam1。

这与ssm param store进行前缀搜索的能力很好地协调。 /application/my_nice_app前缀是默认的“private”作用域。

importblinkistconfig.Config# setup the Config to use the SSM as config storeconfig=blinkistconfig.Config(env="development",adapter_type="SSM",app_name="my_nice_app")my_config_value=config.get("some/folder/config")# This will try to get a parameter from SSM at "/application/my_nice_app/some/folder/config"

也可以有其他作用域,可能在应用程序之间共享。 例如

my_config_value = config.get("another/config", scope="global")

# This will replace `my_nice_app` with `global` and try to resolve "/application/global/another/config"

开发

安装开发需求

pip install -r requirements/dev.txt
pip install -e .

运行测试

AWS_DEFAULT_REGION="us-east-1" pytest --spec

贡献

github上的https://github.com/blinkist/blinkist-config-python欢迎错误报告和请求拉取。

许可证

根据MIT License的条款,该包可以作为开放源码提供。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何将cassandra中的行数据转换为与列相关的嵌套json   java如何使用jcr XPath在jcr:content/@jcr:data中搜索?   java在使用openCV进行安卓开发时如何利用手机的广角镜头   java解析扩展了接口,结束了一个潜在的无限循环   位置服务的@Override方法中存在java Android应用程序错误   java本地线程的用途和需求是什么   具有左右子访问的java节点树遍历   java验证JsonWebToken签名   JUL日志处理程序中的java日志记录   嵌入式Java读取给定时间段的串行数据。   java有没有办法从多个URL获取多个图像?   java线程通过等待intent阻止自己发送intent   java Spring MVC解析多部分内容请求   java JPA/Hibernate静态元模型属性未填充NullPointerException   java格式错误的字符(需要引号,得到I)~正在处理   java为什么PrintWriter对象抛出FileNotFoundException?   java Neo4j未正确保存标签   java IE不加载图像