mirror of
https://github.com/usestrix/strix.git
synced 2026-08-19 10:05:12 +02:00
fix: --config flag now fully overrides ~/.strix/cli-config.json (#457)
* fix: --config flag now fully overrides ~/.strix/cli-config.json (fixes #377) Previously, env vars applied from the default config at module import time were not cleared when --config was later processed, causing settings from ~/.strix/cli-config.json to leak into runs that specified a custom config. Track which vars were applied by the initial default-config load in Config._applied_from_default. In apply_config_override, clear those vars before applying the custom config so only the custom file's settings take effect. * Add config override regression test * Make config override test setup explicit --------- Co-authored-by: octo-patch <octo-patch@github.com> Co-authored-by: bearsyankees <bearsyankees@gmail.com>
This commit is contained in:
co-authored by
octo-patch
bearsyankees
parent
60abc09ff9
commit
9fb101282f
@@ -6,6 +6,7 @@ Strix Agent Interface
|
||||
import argparse
|
||||
import asyncio
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
from pathlib import Path
|
||||
@@ -528,6 +529,12 @@ def pull_docker_image() -> None:
|
||||
|
||||
|
||||
def apply_config_override(config_path: str) -> None:
|
||||
# Clear env vars that were automatically applied from the default config file
|
||||
# so they don't leak into the custom config context.
|
||||
for var_name in Config._applied_from_default:
|
||||
os.environ.pop(var_name, None)
|
||||
Config._applied_from_default = {}
|
||||
|
||||
Config._config_file_override = validate_config_file(config_path)
|
||||
apply_saved_config(force=True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user