🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

zeconfig

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zeconfig

Configuration Manager Package

0.1.4
Maintainers
1

ZeConfig EN - BR

Buid Tests Release

ZeConfig

ZeConfig is a Python library designed to manage application configurations, making it easier to handle sensitive data and environment-specific settings. It supports configuration files in both TOM, JSON, YAML, YML and ENV formats.

Features

  • Automatic detection of configuration file location within the current directory or its subdirectories.
  • Support for TOML, JSON, YAML, YML and ENV configuration files.
  • Easy access to environment-specific keys and values.

Installation

pip install zeconfig

Usage

0. Creating a configuration file

At the root of the project, create a file with one of the extensions .toml, .json, .yaml, .yml or .env.

For example: config.json

1. Configuration File Format

Example config.json

{
    "DATABASE_URL":  "sqlite:///dev.db",
    "SECRET_KEY": "dev-secret"
}

2. Initialize ZeConfig

from ze import config

3. Manage Environment Settings

Retrieve a value for a specific key in the current environment:

DATABASE_URL = config("DATABASE_URL")
print(f"Database URL: {DATABASE_URL}")

>>> OUTPUT: 
    sqlite:///dev.db

Error Handling

ZeConfig raises descriptive exceptions for common issues:

  • KeyError: Missing environment or key in the configuration file.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions are welcome! Please open an issue or submit a pull request on the GitHub repository.

Contact

For questions or support, please reach out to uadsonpy@gmail.com.

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