forked from microsoft/rag-experiment-accelerator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenv_to_keyvault.py
28 lines (19 loc) · 929 Bytes
/
env_to_keyvault.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""
This script is used to create secrets in Azure Keyvault from the environment variables.
For the list of environment parameters that will be created as secrets, please refer to the Environment class in rag_experiment_accelerator/config/environment.py.
"""
import argparse
from rag_experiment_accelerator.config.environment import Environment
from rag_experiment_accelerator.utils.logging import get_logger
logger = get_logger(__name__)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
environment = Environment.from_env_or_keyvault()
logger.info("Creating secrets in Keyvault from the environment")
logger.info("The following secrets will be created:")
for secret in environment.fields():
logger.info(f" - {secret[0]}")
environment.to_keyvault()
logger.info(
f"Secrets in Keyvault {environment.azure_key_vault_endpoint} have been created successfully."
)