add allow_prompt parameter to get_secret to support non-interactive secret retrieval

This commit is contained in:
CPTN Cosmo 2026-04-18 15:43:11 +02:00
parent c754fc7e7a
commit 869c2927d3

View file

@ -224,7 +224,7 @@ def detect_launch_command():
return commands
def get_secret(config, config_path):
def get_secret(config, config_path, allow_prompt=True):
"""
Retrieves the OTP secret in the following priority:
1. System Keyring (SERVICE_NAME, USERNAME) - if available
@ -266,6 +266,9 @@ def get_secret(config, config_path):
# No keyring, just use config
return secret
if not allow_prompt:
return None
# 3. Prompt User
if HAS_KEYRING:
print("\nOTP Secret not found in keyring.")