diff --git a/invokeai/app/services/config/invokeai_config.py b/invokeai/app/services/config/invokeai_config.py index 65bf9b9eba..51ccf45704 100644 --- a/invokeai/app/services/config/invokeai_config.py +++ b/invokeai/app/services/config/invokeai_config.py @@ -277,6 +277,7 @@ class InvokeAIAppConfig(InvokeAISettings): class Config: validate_assignment = True + env_prefix = "INVOKEAI" def parse_args(self, argv: Optional[list[str]] = None, conf: Optional[DictConfig] = None, clobber=False): """ diff --git a/tests/test_config.py b/tests/test_config.py index a950a9c06f..2b2492f6a6 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -121,6 +121,12 @@ def test_env_override(patch_rootdir): conf.parse_args(conf=init1, argv=[]) assert conf.max_cache_size == 20 + # make sure that prefix is respected + del os.environ["INVOKEAI_always_use_cpu"] + os.environ["always_use_cpu"] = "True" + conf.parse_args(conf=init1, argv=[]) + assert conf.always_use_cpu is False + def test_root_resists_cwd(patch_rootdir): from invokeai.app.services.config import InvokeAIAppConfig