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:
-
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()
-
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
Built Distribution
File details
Details for the file gigaml_secrets-0.47.tar.gz
.
File metadata
- Download URL: gigaml_secrets-0.47.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73ffe0c2186fd1981e664673b527cc46c830eaf7329d87a90f7e944bd8f7c518 |
|
MD5 | cba5b509df83f0faeb84d7f70e72cc79 |
|
BLAKE2b-256 | c98189f6580b5a0893f77650da66c517668be3fafa3c42359f46244dd514d1ba |
File details
Details for the file gigaml_secrets-0.47-py3-none-any.whl
.
File metadata
- Download URL: gigaml_secrets-0.47-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5ee892e31e5a3cc0299324959738d45f68ec762718394e266d90397beabf2c7 |
|
MD5 | 17c6c2db31e02a3300279567f511acaa |
|
BLAKE2b-256 | 30043829c765dc99f9f5676cc38e2ee40f539e5924b408e576ffb8ddb38d9da2 |