removed sanitizer
This commit is contained in:
parent
db60ada05f
commit
9efd445559
2 changed files with 6 additions and 27 deletions
|
|
@ -12,7 +12,6 @@ from dotenv import load_dotenv
|
|||
from utils.logging_config import get_logger
|
||||
|
||||
from ..utils.validation import (
|
||||
sanitize_env_value,
|
||||
validate_documents_paths,
|
||||
validate_google_oauth_client_id,
|
||||
validate_non_empty,
|
||||
|
|
@ -548,17 +547,12 @@ class EnvManager:
|
|||
|
||||
# Check if OPENRAG_VERSION is already set in .env
|
||||
if self.env_file.exists():
|
||||
env_content = self.env_file.read_text()
|
||||
if "OPENRAG_VERSION" in env_content:
|
||||
# Already set, check if it needs updating
|
||||
for line in env_content.splitlines():
|
||||
if line.strip().startswith("OPENRAG_VERSION"):
|
||||
existing_value = line.split("=", 1)[1].strip()
|
||||
existing_value = sanitize_env_value(existing_value)
|
||||
if existing_value == current_version:
|
||||
# Already correct, no update needed
|
||||
return
|
||||
break
|
||||
# Load .env file using load_dotenv
|
||||
load_dotenv(dotenv_path=self.env_file, override=False)
|
||||
existing_value = os.environ.get("OPENRAG_VERSION", "")
|
||||
if existing_value and existing_value == current_version:
|
||||
# Already correct, no update needed
|
||||
return
|
||||
|
||||
# Set or update OPENRAG_VERSION
|
||||
self.config.openrag_version = current_version
|
||||
|
|
|
|||
|
|
@ -96,21 +96,6 @@ def validate_non_empty(value: str) -> bool:
|
|||
return bool(value and value.strip())
|
||||
|
||||
|
||||
def sanitize_env_value(value: str) -> str:
|
||||
"""Sanitize environment variable value."""
|
||||
# Remove leading/trailing whitespace
|
||||
value = value.strip()
|
||||
|
||||
# Remove quotes if they wrap the entire value
|
||||
if len(value) >= 2:
|
||||
if (value.startswith('"') and value.endswith('"')) or (
|
||||
value.startswith("'") and value.endswith("'")
|
||||
):
|
||||
value = value[1:-1]
|
||||
|
||||
return value
|
||||
|
||||
|
||||
def validate_documents_paths(paths_str: str) -> tuple[bool, str, list[str]]:
|
||||
"""
|
||||
Validate comma-separated documents paths for volume mounting.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue