Skip to content

Commit

Permalink
BUG: Token validation fails for secret entries that don't exist
Browse files Browse the repository at this point in the history
Change to using .get rather than indexing as we can return an empty string to the validate method which will fail for us. Whereas indexing doesn't let the validation function carry out fully as it errors early
  • Loading branch information
khalford committed Jan 16, 2025
1 parent bb1d6f8 commit eb099d6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cloud-chatops/src/helper/read_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def get_token(secret: str) -> str:
path = get_path()
with open(path + "secrets/secrets.yml", "r", encoding="utf-8") as secrets:
secrets_data = yaml.safe_load(secrets)
return secrets_data[secret]
return secrets_data.get(secret, "")


def get_config(section: str) -> Union[List, Dict, str]:
Expand Down

0 comments on commit eb099d6

Please sign in to comment.