Skip to main content

nextpertise-envy-loader

A reusable helper for Pydantic that fetches environment variables from an Envy API using a Keycloak-secured token. It automatically writes these variables to a .env.envy file and prepends it to your environment configuration.


📦 Installation

Install via Poetry:

poetry add nextpertise-envy-settings

Or with pip:

pip install nextpertise-envy-settings

⸻

🚀 Usage

To load your environment configuration into a .env.envy file:

from nextpertise_envy_settings import EnvySettingsLoader

EnvySettingsLoader.load_env_file(
    envy_env="SCORE_DEVELOPMENT"
)

This will:

  • Check for required settings in environment variables (or fall back to defaults).
  • Load client_id and client_secret from environment or ~/.envy/auth.json if not passed explicitly.
  • Fetch remote settings from the configured Envy environment.
  • Write them to .env.envy in the current directory.

Optional overrides

You can override default URLs or encoding directly:

EnvySettingsLoader.load_env_file(
    envy_env="SCORE_DEVELOPMENT",
    envy_url="https://custom-envy.example.com",
    keycloak_url="https://keycloak.example.com/realms/envy",
    filename=".env.generated",
    encoding="utf-8"
)

✅ If client_id and client_secret are not passed or set in environment variables, they are loaded from ~/.envy/auth.json.

⸻

🔧 Environment Variables (optional)

Instead of hardcoding the config, you can also use these environment variables:

Variable Description
ENV_API_BASE_URL Base URL for Envy API
ENV_API_KEYCLOAK_URL Keycloak realm URL
ENV_API_KEYCLOAK_CLIENT_ID OAuth2 client ID
ENV_API_KEYCLOAK_TOKEN OAuth2 client secret
ENV_API_ENVIRONMENT Target environment name

⸻

📁 Example .env.envy

MYSQL_USER=abc MYSQL_PASSWORD=xyz REDIS_HOST=localhost

Metadata

Release files for nextpertise-envy-settings 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nextpertise-envy-settings 0.4.0
File Size Uploaded Provenance
nextpertise_envy_settings-0.4.0.tar.gz 3.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for nextpertise-envy-settings 0.4.0
File Interpreter ABI Platform
nextpertise_envy_settings-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 6.6 kB

Release files / nextpertise_envy_settings-0.4.0.tar.gz

Download URL nextpertise_envy_settings-0.4.0.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ba67c021193acf9d08153563f96ad4b85db090af856b8d57ae61385e9f0e8460
BLAKE2b-256 checksum
How to use checksums
664587517a8ab0de632bb3cea8de63156027c03b1f81c4ac56b22a7c81ab42ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.11.8 Darwin/23.4.0

Release files / nextpertise_envy_settings-0.4.0-py3-none-any.whl

Download URL nextpertise_envy_settings-0.4.0-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
503eb16dd08fe2bdcca51471b6417ca4e0ac764da020833af72448d06f02acc1
BLAKE2b-256 checksum
How to use checksums
94bedf70cbff32a88cc7f218fdf190df5a46d89a4d37e340de2d9beef43274a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.11.8 Darwin/23.4.0

Security for nextpertise-envy-settings 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page