From e33011560e8f12ece38609189a524ae90e19f369 Mon Sep 17 00:00:00 2001 From: pyth0n1c Date: Mon, 4 Nov 2024 15:47:36 -0800 Subject: [PATCH] Manually port changed raised by Res260. --- contentctl/objects/config.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/contentctl/objects/config.py b/contentctl/objects/config.py index cbf6929f..7c9afb52 100644 --- a/contentctl/objects/config.py +++ b/contentctl/objects/config.py @@ -830,10 +830,18 @@ class test(test_common): model_config = ConfigDict(use_enum_values=True,validate_default=True, arbitrary_types_allowed=True) container_settings:ContainerSettings = ContainerSettings() test_instances: List[Container] = Field([], exclude = True, validate_default=True) - splunk_api_username: Optional[str] = Field(default=None, exclude = True,description="Splunk API username used for running appinspect or installating apps from Splunkbase") - splunk_api_password: Optional[str] = Field(default=None, exclude = True, description="Splunk API password used for running appinspect or installaing apps from Splunkbase") + splunk_api_username: None | str = Field(default=None, exclude = True,description="Splunk API username used for running appinspect or installating apps from Splunkbase. Can be replaced by the 'SPLUNKBASE_USERNAME' environment variable.") + splunk_api_password: None | str = Field(default=None, exclude = True, description="Splunk API password used for running appinspect or installaing apps from Splunkbase. Can be replaced by the 'SPLUNKBASE_PASSWORD' environment variable.") + + def __init__(self, **kwargs: Any): + if "SPLUNKBASE_USERNAME" in environ: + kwargs['splunk_api_username'] = environ["SPLUNKBASE_USERNAME"] + if "SPLUNKBASE_PASSWORD" in environ: + kwargs['splunk_api_password'] = environ["SPLUNKBASE_PASSWORD"] + super().__init__(**kwargs) + def getContainerInfrastructureObjects(self)->Self: try: self.test_instances = self.container_settings.getContainers()