making sure that claude code can run via the archgw cli

This commit is contained in:
Salman Paracha 2025-09-28 14:15:42 -07:00
parent 1b7f9e43e7
commit 2f611f74a8
9 changed files with 422 additions and 30 deletions

View file

@ -88,6 +88,36 @@ def load_env_file_to_dict(file_path):
return env_dict
def read_config_file(path="."):
"""Read configuration from arch_config.yaml or config.yaml in the specified path."""
config_files = ["arch_config.yaml", "config.yaml"]
for config_file in config_files:
config_path = os.path.abspath(os.path.join(path, config_file))
if os.path.exists(config_path):
try:
with open(config_path, "r") as f:
return yaml.safe_load(f)
except Exception as e:
log.warning(f"Error reading {config_path}: {e}")
continue
return {}
def find_config_file(path=".", file=None):
"""Find the appropriate config file path."""
if file:
# If a file is provided, process that file
return os.path.abspath(file)
else:
# If no file is provided, use the path and look for arch_config.yaml first, then config.yaml for convenience
arch_config_file = os.path.abspath(os.path.join(path, "arch_config.yaml"))
if not os.path.exists(arch_config_file):
arch_config_file = os.path.abspath(os.path.join(path, "config.yaml"))
return arch_config_file
def stream_access_logs(follow):
"""
Get the archgw access logs