Skip to main content

Get secrets from Google Cloud Secret Manager or Environment.

Project description

environ_secretmanager

The environ_secretmanager module is designed to be used to download Google Cloud Secrets Manager secrets and set them as environment variables. This is useful for using secrets in various environments, and works especially well with App Engine and Cloud Functions where the correct environment variables can be created in an env file during CI/CD and used in the final build files for production.

Usage

from environ_secretmanager.env_secrets import EnvironSecretManager

secrets = EnvironSecretManager(GOOGLE_CLOUD_PROJECT_ID="my-project-id")

# To create a .env file with the secrets
secrets.create_dot_env_file()

# To use the secrets in the current environment
MY_SECRET = secrets.get_env_secret("MY_SECRET", 1)

Build For Local Distribution

Build the files then extract the setup.py file from the tarball and run it to install the package locally.

poetry build --format sdist
tar -xvf dist/*-`poetry version -s`.tar.gz -O '*/setup.py' > setup.py

Then on the machine you want to install the package on, run

pip install -e .

Development

This project uses Poetry in development to create a virtual environment and manage dependencies. To install poetry, run

curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -

Then, from the same directory as pyproject.toml, run

poetry install

Run poetry commands from this same directory to manage your development environment and/or setup the virtual environment created in the last step in your IDE.

See Poetry Docs for more info.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

environ_secretmanager-0.2.1.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

environ_secretmanager-0.2.1-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file environ_secretmanager-0.2.1.tar.gz.

File metadata

  • Download URL: environ_secretmanager-0.2.1.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.10.10 Darwin/25.3.0

File hashes

Hashes for environ_secretmanager-0.2.1.tar.gz
Algorithm Hash digest
SHA256 65d32fc5e129731ec67b9ef0c2e7ac1b2d72f6509a045f29f4999ad0e6d4fd5e
MD5 24e73a99264f8303d8f6c8e84a606b94
BLAKE2b-256 937ebb407051fd17c35a294e23fcc8d04860a884d37535487bf9460c67244b74

See more details on using hashes here.

File details

Details for the file environ_secretmanager-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for environ_secretmanager-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a1b2dcdd02067144db5610a8358d26d9ef725637033c208ce289293a8c7c1585
MD5 5b0688b755be9e9b0d4344281653fe2c
BLAKE2b-256 c6c438d7ed0940da01d6d715742b9963912a6242ce45b0853a51cba41cc77008

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page