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.logging_config import get_logger
|
||||||
|
|
||||||
from ..utils.validation import (
|
from ..utils.validation import (
|
||||||
sanitize_env_value,
|
|
||||||
validate_documents_paths,
|
validate_documents_paths,
|
||||||
validate_google_oauth_client_id,
|
validate_google_oauth_client_id,
|
||||||
validate_non_empty,
|
validate_non_empty,
|
||||||
|
|
@ -548,17 +547,12 @@ class EnvManager:
|
||||||
|
|
||||||
# Check if OPENRAG_VERSION is already set in .env
|
# Check if OPENRAG_VERSION is already set in .env
|
||||||
if self.env_file.exists():
|
if self.env_file.exists():
|
||||||
env_content = self.env_file.read_text()
|
# Load .env file using load_dotenv
|
||||||
if "OPENRAG_VERSION" in env_content:
|
load_dotenv(dotenv_path=self.env_file, override=False)
|
||||||
# Already set, check if it needs updating
|
existing_value = os.environ.get("OPENRAG_VERSION", "")
|
||||||
for line in env_content.splitlines():
|
if existing_value and existing_value == current_version:
|
||||||
if line.strip().startswith("OPENRAG_VERSION"):
|
# Already correct, no update needed
|
||||||
existing_value = line.split("=", 1)[1].strip()
|
return
|
||||||
existing_value = sanitize_env_value(existing_value)
|
|
||||||
if existing_value == current_version:
|
|
||||||
# Already correct, no update needed
|
|
||||||
return
|
|
||||||
break
|
|
||||||
|
|
||||||
# Set or update OPENRAG_VERSION
|
# Set or update OPENRAG_VERSION
|
||||||
self.config.openrag_version = current_version
|
self.config.openrag_version = current_version
|
||||||
|
|
|
||||||
|
|
@ -96,21 +96,6 @@ def validate_non_empty(value: str) -> bool:
|
||||||
return bool(value and value.strip())
|
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]]:
|
def validate_documents_paths(paths_str: str) -> tuple[bool, str, list[str]]:
|
||||||
"""
|
"""
|
||||||
Validate comma-separated documents paths for volume mounting.
|
Validate comma-separated documents paths for volume mounting.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue