Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am cranti on github.
  • I am cranti (https://keybase.io/cranti) on keybase.
  • I have a public key ASC9639k47awdbcg8LgJW0mMvOWmHknep1vAsnQWB2-FxAo

To claim this, I am signing this object:

@cranti
cranti / griftblog2_loaders.py
Last active April 25, 2017 15:10
Demonstrating how values are loaded into BaseConfig classes (loader hierarchy and data conversion)
from grift import DictLoader, EnvLoader
# For this example, the following environment variables should be set:
# AWS_SECRET_KEY='supersecret'
# PORT='5001'
# A DictLoader will be used as a lower priority source:
low_priority = {
'DATABASE_URL': 'postgres://localhost:5432',
'PORT': 5002
@cranti
cranti / griftblog1_config.py
Last active April 24, 2017 22:50
Define a demo configuration class
from grift import BaseConfig, ConfigProperty
from grift.property_types import PostgresType
from schematics.types import BooleanType, StringType, IntType
class AppConfig(BaseConfig):
AWS_SECRET_KEY = ConfigProperty(property_type=StringType(), exclude_from_varz=True)
DATABASE_URL = ConfigProperty(property_type=PostgresType(), exclude_from_varz=True)
DEBUG = ConfigProperty(property_type=BooleanType(), default=False)
PORT = ConfigProperty(property_type=IntType(), default=5000)