Skip to main content

config dictionary with YAML sourcing and secret support

Project description

figtion

Configuration package

Why Though?

This is the simplest config interface with text file support.

Benefits

  • seemless Python dict interface
    • unified config definition and defaults
  • YAML text file source for file-system input & serialization
  • simple precedence
    • defaults keys define config keys
    • YAML values override defaults values
  • secrets support
    • secrets saved to private YAML
    • auto-updates from public YAML

Examples

Config Definition and Defaults

import figtion

defaults = {'my server'       : 'www.bestsite.web'
           ,'number of nodes' : 5
           ,'password'        : 'huduyutakeme4' }
cfg = figtion.Config(defaults=defaults,filepath='~/conf.yml')

print(cfg['my server'])  

This will print 'www.bestsite.web' unless the value of 'my server' in ~/conf.yml has something else.

Config Secrets

When you want a public config file and a separate secret one.

cfg = figtion.Config(defaults=defaults,filepath='~/conf.yml',secretpath='/opt/creds.yml')
cfg.mask('password')

print(cfg['password'])

This will print the value of 'password', which is stored in /opt/creds.yml and not ~/conf.yml. If the value of 'password' is changed in either YAML file, the password will be updated and masked from ~/creds.yml again the next time the class is loaded in Python.

Roadmap

  • 0.9 - secrets store in separate location
  • 1.0 - secrets store in encrypted location

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

figtion-0.9.0.tar.gz (3.5 kB view hashes)

Uploaded Source

Built Distribution

figtion-0.9.0-py3-none-any.whl (4.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page