Project Description

A module for reading values from OS environment variables.

Compared to using os.getenv(), this module provides convenience functions,
for parsing basic datatypes. It also allows specifying optional default values if
the environment variable does not exist. Basic environment variable parsing and
sanitizing is also performed.

Decorators

There are also decorators available to selectively enable or disable functions based on environment
variables.

importenvitro@envitro.decorators.isset('ALLOW_FOO')deffoo():return"Hello World"envitro.write('ALLOW_FOO','1')foo()# allowedenvitro.write('ALLOW_FOO',None)foo()# return "None" and is not executed@envitro.decorators.bool('ALLOW_REMOTE')defget_remote(arg1,arg2):returncall_remote_service(arg1,arg2)envitro.write('ALLOW_REMOTE','True')get_remote('hello','world')# calls remote serviceenvitro.write('ALLOW_REMOTE','False')get_remote('hello','world')# returns "None" and is not executed