This is an automated email from the ASF dual-hosted git repository.

zihaoxiang pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new ade9d399a8 [Improvement-17708][API] Remove default value of 
`python-gateway.auth-token` (#17801)
ade9d399a8 is described below

commit ade9d399a85cee8bed0f1ee0587274ed4f3eff9e
Author: Wenjun Ruan <[email protected]>
AuthorDate: Sat Dec 20 19:06:34 2025 +0800

    [Improvement-17708][API] Remove default value of 
`python-gateway.auth-token` (#17801)
---
 docs/docs/en/guide/upgrade/incompatible.md                  |  1 +
 .../dolphinscheduler/api/configuration/ApiConfig.java       | 13 ++++++++++++-
 dolphinscheduler-api/src/main/resources/application.yaml    |  5 ++---
 .../src/main/resources/application.yaml                     |  9 ++++-----
 4 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/docs/docs/en/guide/upgrade/incompatible.md 
b/docs/docs/en/guide/upgrade/incompatible.md
index c6a8f3023c..e30058aef9 100644
--- a/docs/docs/en/guide/upgrade/incompatible.md
+++ b/docs/docs/en/guide/upgrade/incompatible.md
@@ -36,4 +36,5 @@ This document records the incompatible updates between each 
version. You need to
 
 * Renamed the publicKey field to privateKey in the SSH connection parameters 
under the datasource configuration. 
([#17666])(https://github.com/apache/dolphinscheduler/pull/17666)
 * Add table t_ds_serial_command. 
([#17531])(https://github.com/apache/dolphinscheduler/pull/17531)
+* Remove the default value of `python-gateway.auth-token` at 
`api-server/application.yaml`. 
([#17801])(https://github.com/apache/dolphinscheduler/pull/17801)
 
diff --git 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/configuration/ApiConfig.java
 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/configuration/ApiConfig.java
index f5f22e0eef..2ba09ee37b 100644
--- 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/configuration/ApiConfig.java
+++ 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/configuration/ApiConfig.java
@@ -17,12 +17,15 @@
 
 package org.apache.dolphinscheduler.api.configuration;
 
+import org.apache.commons.lang3.StringUtils;
+
 import java.util.HashMap;
 import java.util.Map;
 
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
+import lombok.ToString;
 import lombok.extern.slf4j.Slf4j;
 
 import org.springframework.boot.context.properties.ConfigurationProperties;
@@ -53,9 +56,16 @@ public class ApiConfig implements Validator {
 
     @Override
     public void validate(Object target, Errors errors) {
+        validatePythonGateway(errors);
         printConfig();
     }
 
+    private void validatePythonGateway(Errors errors) {
+        if (pythonGateway.isEnabled() && 
StringUtils.isEmpty(pythonGateway.getAuthToken())) {
+            errors.rejectValue("pythonGateway.auth-token", null, "should not 
be empty when enabled is true");
+        }
+    }
+
     private void printConfig() {
         log.info("API config: baseUrl -> {} ", baseUrl);
         log.info("API config: uiUrl -> {} ", uiUrl);
@@ -76,12 +86,13 @@ public class ApiConfig implements Validator {
         private Map<String, Integer> customizeTenantQpsRate = new HashMap<>();
     }
 
+    @ToString(exclude = "authToken")
     @Data
     @NoArgsConstructor
     @AllArgsConstructor
     public static class PythonGatewayConfiguration {
 
-        private boolean enabled = true;
+        private boolean enabled = false;
         private String gatewayServerAddress = "0.0.0.0";
         private int gatewayServerPort = 25333;
         private String pythonAddress = "127.0.0.1";
diff --git a/dolphinscheduler-api/src/main/resources/application.yaml 
b/dolphinscheduler-api/src/main/resources/application.yaml
index 6d0cadf5e8..e4e5ca6b3a 100644
--- a/dolphinscheduler-api/src/main/resources/application.yaml
+++ b/dolphinscheduler-api/src/main/resources/application.yaml
@@ -154,9 +154,8 @@ api:
   python-gateway:
     # Weather enable python gateway server or not. The default value is false.
     enabled: false
-    # Authentication token for connection from python api to python gateway 
server. Should be changed the default value
-    # when you deploy in public network.
-    auth-token: jwUDzpLsNKEFER4*a8gruBH_GsAurNxU7A@Xc
+    # Authentication token for connection from python api to python gateway 
server. Should not be empty when enabled
+    auth-token:
     # The address of Python gateway server start. Set its value to `0.0.0.0` 
if your Python API run in different
     # between Python gateway server. It could be be specific to other address 
like `127.0.0.1` or `localhost`
     gateway-server-address: 0.0.0.0
diff --git 
a/dolphinscheduler-standalone-server/src/main/resources/application.yaml 
b/dolphinscheduler-standalone-server/src/main/resources/application.yaml
index 0c835ad319..71c309e6d7 100644
--- a/dolphinscheduler-standalone-server/src/main/resources/application.yaml
+++ b/dolphinscheduler-standalone-server/src/main/resources/application.yaml
@@ -249,11 +249,10 @@ api:
     #tenant1: 11
     #tenant2: 20
   python-gateway:
-    # Weather enable python gateway server or not. The default value is true.
-    enabled: true
-    # Authentication token for connection from python api to python gateway 
server. Should be changed the default value
-    # when you deploy in public network.
-    auth-token: jwUDzpLsNKEFER4*a8gruBH_GsAurNxU7A@Xc
+    # Weather enable python gateway server or not. The default value is false.
+    enabled: false
+    # Authentication token for connection from python api to python gateway 
server. Should not be empty when enabled
+    auth-token:
     # The address of Python gateway server start. Set its value to `0.0.0.0` 
if your Python API run in different
     # between Python gateway server. It could be be specific to other address 
like `127.0.0.1` or `localhost`
     gateway-server-address: 0.0.0.0

Reply via email to