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.46.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: gigaml_secrets-0.46.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.46.tar.gz
Algorithm Hash digest
SHA256 a1855517eb8ab26454c040b7faa73bc7f4b7ffb8e92b8c4bd84974772144ebd2
MD5 5b2b0d92436e39e9a9c0db606790915e
BLAKE2b-256 f6ef866694107c213d29cf33a9ed2d9ef708ba9e4f1624221f3b21c8fb858979

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gigaml_secrets-0.46-py3-none-any.whl
Algorithm Hash digest
SHA256 4c344c35af5b967999766f7414aa4724ad9e5d9e80d75297e43090e518c62016
MD5 18f48e6c3369fd46e566fd0aa558a4e6
BLAKE2b-256 d582089a8487c07ecdfb5a5e6772376fd8d5fda3ba1b871401c6e40bb262896e

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