New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

envia

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

envia

Manage your app configuration using env variables

  • 0.0.2
  • PyPI
  • Socket score

Maintainers
1

Envia

Did you ever lose track of all environment variables you can use to configure a project? Envia is a simple utility that allows you to group them together.

Installation

pip install envia

Usage

You can use Envia as follows

# app/config.py

from envia import EnvVar

APP_DB_VENDOR = EnvVar("APP_DB_VENDOR", default="postgres")
APP_DB_PORT = EnvVar("APP_DB_PORT", default="5432")
APP_DB_HOST = EnvVar("APP_DB_HOST")

# require() can be used to ensure early failure. 
# This fails if APP_REQUIRED_VAR is not set
APP_REQUIRED_VAR = EnvVar("APP_REQUIRED_VAR").require()

To use the environment values you can do

# app/db.py
import app.config as cfg

def connect():
	vendor = cfg.APP_DB_VENDOR.get_required()
	port = cfg.APP_DB_PORT.get_required()
	
	# This fails APP_DB_HOST is not set
	host = cfg.APP_DB_HOST.get_required()
	
	# This returns None if APP_DB_HOST is not set
	host = cfg.APP_DB_HOST.require()

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc