Friendlier way to write your config.
Project description
What is iubeo?
Friendlier way to write your config.
What is it good for?
You write how you want to read your config.
from iubeo import config
def list_from_string(val):
return val.split(',')
CONFIG = config({
'DATABASE': {
'USER': str
'PASSWORD': str
'HOST': str
'PORT: str
},
'ALLOWED_HOSTS': list_from_string,
})
It creates the environment variable names for you, and reads them from the environment, casting it to the final nodes.
Now your can just chain the attributes, and if it is the last node on the above dictionary, you get the environment variable casted to given callable.
DATABASE__USER=isik-kaplan
DATABASE__PASSWORD=isik-kaplan-db-password
DATABASE__HOST=localhost
DATABASE__PORT=5432
ALLOWED__HOSTS=isik-kaplan.com,api.isik-kaplan.com,www.isik-kaplan.com
are read from the environment, and are casted when you access the attribute.
CONFIG.DATABASE.USER # "isik-kaplan"
CONFIG.DATABASE.PASSWORD # "isik-kaplan-db-password"
CONFIG.DATABASE.HOST # "localhost"
CONFIG.DATABASE.PORT # "5432"
CONFIG.ALLOWED_HOSTS # ["isik-kaplan.com", "api.isik-kaplan.com", "www.isik-kaplan.com"]
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
iubeo-0.1.1.tar.gz
(3.2 kB
view hashes)
Built Distribution
iubeo-0.1.1-py3-none-any.whl
(3.1 kB
view hashes)