Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
Refactor OpenSearch config to separate use_ssl and verify_certs flags (#20075)
He Huang6f48af2610b5
diff --git a/api/.env.example b/api/.env.exampleindex 9dec564c28e..e63aac1409c 100644--- a/api/.env.example+++ b/api/.env.example@@ -269,6 +269,7 @@ OPENSEARCH_PORT=9200OPENSEARCH_USER=adminOPENSEARCH_PASSWORD=adminOPENSEARCH_SECURE=true+OPENSEARCH_VERIFY_CERTS=true# Baidu configurationBAIDU_VECTOR_DB_ENDPOINT=http://127.0.0.1:5287diff --git a/api/configs/middleware/vdb/opensearch_config.py b/api/configs/middleware/vdb/opensearch_config.pyindex 96f478e9a6a..9fd9b601947 100644--- a/api/configs/middleware/vdb/opensearch_config.py+++ b/api/configs/middleware/vdb/opensearch_config.py@@ -33,6 +33,11 @@ class OpenSearchConfig(BaseSettings):default=False,)+ OPENSEARCH_VERIFY_CERTS: bool = Field(+ description="Whether to verify SSL certificates for HTTPS connections (recommended to set True in production)",+ default=True,+ )+OPENSEARCH_AUTH_METHOD: AuthMethod = Field(description="Authentication method for OpenSearch connection (default is 'basic')",default=AuthMethod.BASIC,diff --git a/api/core/rag/datasource/vdb/opensearch/opensearch_vector.py b/api/core/rag/datasource/vdb/opensearch/opensearch_vector.pyindex e23b8d197f4..6991598ce61 100644--- a/api/core/rag/datasource/vdb/opensearch/opensearch_vector.py+++ b/api/core/rag/datasource/vdb/opensearch/opensearch_vector.py@@ -23,7 +23,8 @@ logger = logging.getLogger(__name__)class OpenSearchConfig(BaseModel):host: strport: int- secure: bool = False+ secure: bool = False # use_ssl+ verify_certs: bool = Trueauth_method: Literal["basic", "aws_managed_iam"] = "basic"user: Optional[str] = Nonepassword: Optional[str] = None@@ -42,6 +43,8 @@ class OpenSearchConfig(BaseModel):raise ValueError("config OPENSEARCH_AWS_REGION is required for AWS_MANAGED_IAM auth method")if not values.get("aws_service"):raise ValueError("config OPENSEARCH_AWS_SERVICE is required for AWS_MANAGED_IAM auth method")+ if not values.get("OPENSEARCH_SECURE") and values.get("OPENSEARCH_VERIFY_CERTS"):+ raise ValueError("verify_certs=True requires secure (HTTPS) connection")return valuesdef create_aws_managed_iam_auth(self) -> Urllib3AWSV4SignerAuth:@@ -57,7 +60,7 @@ class OpenSearchConfig(BaseModel):params = {"hosts": [{"host": self.host, "port": self.port}],"use_ssl": self.secure,- "verify_certs": self.secure,+ "verify_certs": self.verify_certs,"connection_class": Urllib3HttpConnection,"pool_maxsize": 20,}@@ -279,6 +282,7 @@ class OpenSearchVectorFactory(AbstractVectorFactory):host=dify_config.OPENSEARCH_HOST or "localhost",port=dify_config.OPENSEARCH_PORT,secure=dify_config.OPENSEARCH_SECURE,+ verify_certs=dify_config.OPENSEARCH_VERIFY_CERTS,auth_method=dify_config.OPENSEARCH_AUTH_METHOD.value,user=dify_config.OPENSEARCH_USER,password=dify_config.OPENSEARCH_PASSWORD,diff --git a/docker/.env.example b/docker/.env.exampleindex aacef0e1f59..86c1a5779ae 100644--- a/docker/.env.example+++ b/docker/.env.example@@ -531,6 +531,7 @@ RELYT_DATABASE=postgresOPENSEARCH_HOST=opensearchOPENSEARCH_PORT=9200OPENSEARCH_SECURE=true+OPENSEARCH_VERIFY_CERTS=trueOPENSEARCH_AUTH_METHOD=basicOPENSEARCH_USER=adminOPENSEARCH_PASSWORD=admindiff --git a/docker/docker-compose.yaml b/docker/docker-compose.yamlindex bb711699070..371646eb9f3 100644--- a/docker/docker-compose.yaml+++ b/docker/docker-compose.yaml@@ -227,6 +227,7 @@ x-shared-env: &shared-api-worker-envOPENSEARCH_HOST: ${OPENSEARCH_HOST:-opensearch}OPENSEARCH_PORT: ${OPENSEARCH_PORT:-9200}OPENSEARCH_SECURE: ${OPENSEARCH_SECURE:-true}+ OPENSEARCH_VERIFY_CERTS: ${OPENSEARCH_VERIFY_CERTS:-true}OPENSEARCH_AUTH_METHOD: ${OPENSEARCH_AUTH_METHOD:-basic}OPENSEARCH_USER: ${OPENSEARCH_USER:-admin}OPENSEARCH_PASSWORD: ${OPENSEARCH_PASSWORD:-admin}