Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

Commit

Permalink
Update get_credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
jinleevv committed Jul 31, 2023
1 parent 624a2a6 commit 71b6beb
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions flojoy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,26 +325,19 @@ def set_env_var_key(key: str, value: str):
file.write(key + ",")


def get_credentials() -> Union[list[dict[str, str]], None]:
def get_credentials() -> Union[dict[str, str], None]:
keys_list: list[str] = []
credentials_list: list[dict[str, str]] = []
credentials_dict: dict[str, str] = {}
home = str(Path.home())
file_path = os.path.join(home, os.path.join(FLOJOY_DIR, "credentials.txt"))
with open(file_path) as f:
for line in f:
for key in line.split(","):
if key and key not in keys_list:
keys_list.append(key)

for key in keys_list:
credentials_list.append(
{
"id": str(uuid.uuid4()),
"username": key,
"password": get_env_var_key(key),
}
)
return credentials_list
credentials_dict[key] = get_env_var_key(key)
return credentials_dict


def clear_flojoy_memory():
Expand Down

0 comments on commit 71b6beb

Please sign in to comment.