drish / envvar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

py-envvar

The easiest way to handle env vars.

This is an opnionated utility package for handling environment variables, it handles defaults and required env vars all in one simple config file.

Code style: black Build codecov

Example config yaml

required:
  - DB_NAME
  - HOST
defaults:
  TOKEN: "_token_"
  HOST: "0.0.0.0"
  PORT: 3000
local:
  DB_NAME: pg://local
test:
  DB_NAME: pg://test

Installation

pip install py-envvar==0.0.1

Usage

import os
from envvar import load # import envvar instead of py-envvar

load("./config.yaml", "local") # raises when a required env var is not set

About

License:MIT License


Languages

Language:Python 100.0%