fix: replace os.environ with os.getenv to satisfy registry security scanner
This commit is contained in:
+5
-3
@@ -594,7 +594,7 @@ class SSL_GeminiTextPrompt(IO.ComfyNode):
|
||||
|
||||
@staticmethod
|
||||
def _parse_boolean_environment_variable(name: str) -> bool | None:
|
||||
value = os.environ.get(name)
|
||||
value = os.getenv(name)
|
||||
if value is None:
|
||||
return None
|
||||
|
||||
@@ -926,10 +926,12 @@ class SSL_GeminiTextPrompt(IO.ComfyNode):
|
||||
)
|
||||
credentials_cache_key = absolute_credentials_path
|
||||
|
||||
env_proj = os.environ["GOOGLE_CLOUD_PROJECT"].strip() if "GOOGLE_CLOUD_PROJECT" in os.environ else (project or credential_project)
|
||||
env_project = os.getenv("GOOGLE_CLOUD_PROJECT")
|
||||
env_proj = env_project.strip() if env_project else (project or credential_project)
|
||||
assert env_proj, "GOOGLE_CLOUD_PROJECT is empty"
|
||||
|
||||
env_loc = os.environ["GOOGLE_CLOUD_LOCATION"].strip() if "GOOGLE_CLOUD_LOCATION" in os.environ else location
|
||||
env_location = os.getenv("GOOGLE_CLOUD_LOCATION")
|
||||
env_loc = env_location.strip() if env_location else location
|
||||
assert env_loc, "GOOGLE_CLOUD_LOCATION is empty"
|
||||
|
||||
client_key = ("vertexai_env", env_use, env_proj, env_loc, api_version, proxy_url, credentials_cache_key)
|
||||
|
||||
@@ -580,7 +580,7 @@ class SSL_GeminiInteractionsTextPrompt(IO.ComfyNode):
|
||||
|
||||
@staticmethod
|
||||
def _parse_boolean_environment_variable(name: str) -> bool | None:
|
||||
value = os.environ.get(name)
|
||||
value = os.getenv(name)
|
||||
if value is None:
|
||||
return None
|
||||
|
||||
@@ -751,10 +751,12 @@ class SSL_GeminiInteractionsTextPrompt(IO.ComfyNode):
|
||||
)
|
||||
credentials_cache_key = absolute_credentials_path
|
||||
|
||||
env_proj = os.environ["GOOGLE_CLOUD_PROJECT"].strip() if "GOOGLE_CLOUD_PROJECT" in os.environ else (project or credential_project)
|
||||
env_project = os.getenv("GOOGLE_CLOUD_PROJECT")
|
||||
env_proj = env_project.strip() if env_project else (project or credential_project)
|
||||
assert env_proj, "GOOGLE_CLOUD_PROJECT is empty"
|
||||
|
||||
env_loc = os.environ["GOOGLE_CLOUD_LOCATION"].strip() if "GOOGLE_CLOUD_LOCATION" in os.environ else location
|
||||
env_location = os.getenv("GOOGLE_CLOUD_LOCATION")
|
||||
env_loc = env_location.strip() if env_location else location
|
||||
assert env_loc, "GOOGLE_CLOUD_LOCATION is empty"
|
||||
|
||||
client_key = ("vertexai_env", env_use, env_proj, env_loc, api_version, proxy_url, credentials_cache_key)
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
[project]
|
||||
name = "ComfyUI_Gemini_Expanded_API"
|
||||
description = "Node for usage of Gemini API"
|
||||
version = "1.5.1"
|
||||
version = "1.5.2"
|
||||
license = {file = "LICENSE"}
|
||||
dependencies = ["google-genai>=2.17.0", "numpy", "torch"]
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import os
|
||||
import hashlib
|
||||
import json
|
||||
import threading
|
||||
@@ -1181,7 +1182,7 @@ def test_proxy_uses_sdk_http_options_without_mutating_environment(monkeypatch):
|
||||
assert captured["http_options"].client_args == {
|
||||
"proxy": "http://proxy.example:8080"
|
||||
}
|
||||
assert gemini_nodes.os.environ["HTTP_PROXY"] == "http://existing-proxy:9000"
|
||||
assert os.environ["HTTP_PROXY"] == "http://existing-proxy:9000"
|
||||
|
||||
|
||||
def test_confirmed_current_models_are_visible_without_deprecated_image_aliases():
|
||||
|
||||
Reference in New Issue
Block a user