add load_json_to_environ
This commit is contained in:
parent
fed7d27136
commit
2f6d0c47e5
2 changed files with 13 additions and 7 deletions
|
|
@ -1,3 +1,5 @@
|
|||
import json
|
||||
import os
|
||||
import random
|
||||
import string
|
||||
from dataclasses import dataclass
|
||||
|
|
@ -46,3 +48,11 @@ def generate_random_string(length: int, punctuation=False) -> str:
|
|||
characters += string.punctuation
|
||||
random_string = "".join(random.choice(characters) for _ in range(length))
|
||||
return random_string
|
||||
|
||||
|
||||
def load_json_to_environ(cred_file: Path):
|
||||
with open(cred_file, "r") as f:
|
||||
CREDENTIALS = json.load(f)
|
||||
|
||||
for key, value in CREDENTIALS.items():
|
||||
os.environ[key] = value
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue