fix(platforms/line): fix broken import of non-existent config functions
_adapter_config_interactive() imported get_env_var and set_env_var from
hermes_cli.config, but these do not exist — the actual functions are
get_env_value and save_env_value. This caused an ImportError at runtime,
breaking the entire LINE platform adapter setup.
Pain before: Any user who ran the LINE adapter setup function would get:
ImportError: cannot import name 'get_env_var' from 'hermes_cli.config'
Fix: Import the correct functions with aliased local names:
from hermes_cli.config import get_env_value as _get_env, save_env_value as _set_env
Also fixed an indentation bug introduced during the fix: the 'if value: _set_env()'
block was incorrectly nested inside the except clause.
PR: N32 (hermes-agent audit)
This commit is contained in:
@@ -1695,13 +1695,13 @@ def interactive_setup() -> None:
|
||||
print()
|
||||
|
||||
try:
|
||||
from hermes_cli.config import get_env_var, set_env_var
|
||||
from hermes_cli.config import get_env_value as _get_env, save_env_value as _set_env
|
||||
except ImportError:
|
||||
print("hermes_cli.config not available; set LINE_* vars manually in ~/.hermes/.env")
|
||||
return
|
||||
|
||||
def _prompt(var: str, prompt: str, *, secret: bool = False) -> None:
|
||||
existing = get_env_var(var) if callable(get_env_var) else None
|
||||
existing = _get_env(var) if callable(_get_env) else None
|
||||
suffix = " [keep current]" if existing else ""
|
||||
try:
|
||||
if secret:
|
||||
@@ -1713,7 +1713,7 @@ def interactive_setup() -> None:
|
||||
print()
|
||||
return
|
||||
if value:
|
||||
set_env_var(var, value)
|
||||
_set_env(var, value)
|
||||
|
||||
_prompt("LINE_CHANNEL_ACCESS_TOKEN", "Channel access token", secret=True)
|
||||
_prompt("LINE_CHANNEL_SECRET", "Channel secret", secret=True)
|
||||
|
||||
Reference in New Issue
Block a user