Skip to main content

A library to manage AWS secrets with caching and environment variable integration

Project description

GigaML Secrets

A library to manage AWS secrets with caching and environment variable integration.

Installation

To install the package, use pip:

pip install gigaml_secrets

Setup

Ensure you have your AWS credentials configured. You can set them up using the AWS CLI:

aws configure

Usage

After installing the package, you can use the library in your scripts as follows:

  1. Use the library in your script:

    from gigaml_secrets import CachedSecretsManager, load_secrets
    import os
    
    def main():
        # Specify the environment and list of secrets to load
        env = 'prod'
        secret_names = ['ADMIN_API_KEY', 'BACKEND_API']
        load_secrets(env, secret_names)
    
        # Now you can access the secrets from environment variables
        admin_api_key = os.getenv('ADMIN_API_KEY')
        backend_api = os.getenv('BACKEND_API')
    
        print(f"ADMIN_API_KEY: {admin_api_key}")
        print(f"BACKEND_API: {backend_api}")
    
    if __name__ == "__main__":
        main()
    
  2. Run your script:

    python your_script.py

Example

Here is an example script (main.py) that demonstrates how to use the gigaml_secrets package:

```python
import os
from gigaml_secrets import CachedSecretsManager, load_secrets

def main():
    # Initialize the CachedSecretsManager
    env = 'prod'
    secret_names = ['ADMIN_API_KEY', 'BACKEND_API']
    load_secrets(env, secret_names)

    # Fetch and set secrets as environment variables
    for name in secret_names:
        print(f"Environment variable {name}: {os.getenv(name)}")

if __name__ == "__main__":
    main()
```

License

This project is licensed under the MIT License.

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

gigaml_secrets-0.45.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

gigaml_secrets-0.45-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file gigaml_secrets-0.45.tar.gz.

File metadata

  • Download URL: gigaml_secrets-0.45.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for gigaml_secrets-0.45.tar.gz
Algorithm Hash digest
SHA256 6f86624adf3be14fcf4362459d2e02a72c43b15447ca753e6e1e3d1275a0c08b
MD5 239f549d7c64e2bb4a6dd7da4246ed63
BLAKE2b-256 30fdc860992187e6698b7e6a4146aaf497e7b325a526af682a9b7bef0ff7fde4

See more details on using hashes here.

File details

Details for the file gigaml_secrets-0.45-py3-none-any.whl.

File metadata

File hashes

Hashes for gigaml_secrets-0.45-py3-none-any.whl
Algorithm Hash digest
SHA256 acf279a91ce5ddf59c12701480785c06d7ba93bddfbe2b1a748aae2a2570f3c5
MD5 8b9cd76e4eae7fba5542cb25e1c8f3e9
BLAKE2b-256 c8118ffee07e2e4fde61b40421333cc15f707ed54abe11165d39e5f330b38de2

See more details on using hashes here.

Supported by

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