Yaml Settings Configuration Module
Project description
A Yaml Settings Configuration Module.
A library to help manage project settings, without having to worry about accidentally checking non-public information, like api keys. Along with simple environment variable support.
Example setup
Python Code - Base Functions:
app_settings = load('defaults.yml') update_from_env(test_settings) update_from_file(app_defaults, 'settings.yml') user = app_settings.myproj.databases.primary_sql.user
Python Code - YamlSettings Helper Class:
project_settings = YamlSettings('defaults.yml', 'settings.yml', default_section='myproj') base_settings = project_settings.get_settings() user = base_settings.databases.primary_sql.user
defaults.yml - Default Settings for Project (tracked):
--- # Program Defaults, do not edit this file!!! # All values should be overridden in the following ways: # 1. In the 'settings.yaml' file. # 2. With environment variables. Example myproj.databases.primary_sql.user can # be overridden with MYPROJ_DATABASES_PRIMARY_SQL_USER. myproj: databases: primary_sql: user: my_user passwd: password_here host: db-bouncer-01.postgres.com:5432 db: postgres compress: true engine: postgresql splunk: user: splunk_user_here passwd: password here host: splunk.com port: 8089 redis: redis_host: 127.0.0.1 redis_port: 6379 flask_config: DEBUG: False SECRET_KEY: hard key to guess and keep values secret debug_sql: false debug_profiler: false cache_routes: true logging_config: version: 1 disable_existing_loggers: False formatters: light: format: '%(asctime)s [%(levelname).1s] %(name)s: %(message)s' datefmt: '%Y-%m-%d %H:%M:%S' verbose: format: '%(asctime)s %(levelname) 8s(%(name)s): %(message)s' datefmt: '' handlers: console: class: logging.StreamHandler level: DEBUG formatter: light stream: ext://sys.stdout slack: class: api.slackLogHandler.BufferingSlackWebHookHandler level: INFO formatter: light capacity: 100 organization: KyleJamesWalker token: need_this channel: '#services' username: my-proj-logger icon_emoji: ':happy_panda:' noid: class: logging.NullHandler loggers: requests: level: NOTSET handlers: [noid] propagate: no root: level: NOTSET handlers: - console
settings.yml - Custom Settings (untracked):
--- myproj: databases: primary_sql: user: root passwd: god splunk: user: real_user passwd: pa$$word flask_config: SECRET_KEY: sdfasjksdfASFAS23423f@#$%!$#VR@%UQ% logging_config: handlers: slack: token: 123243294832104981209 root: handlers: - console - slack
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
yamlsettings-0.2.3.tar.gz
(6.9 kB
view details)
File details
Details for the file yamlsettings-0.2.3.tar.gz
.
File metadata
- Download URL: yamlsettings-0.2.3.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38cbf5d9f47c3f5ff2ed7f161ca073b5a1b261c5e058fd712125c89fade71b5a |
|
MD5 | 2b927ad860b7e217d15f3c3d1b1d77c7 |
|
BLAKE2b-256 | e4efb15a3315703814dd6c265793a7bc1941836ba52f9b7cacc05bf0fd0ff5d1 |