Skip to content

Commit ade9d39

Browse files
authored
[Improvement-17708][API] Remove default value of python-gateway.auth-token (#17801)
1 parent 418f035 commit ade9d39

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

docs/docs/en/guide/upgrade/incompatible.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,5 @@ This document records the incompatible updates between each version. You need to
3636

3737
* Renamed the publicKey field to privateKey in the SSH connection parameters under the datasource configuration. ([#17666])(https://github.com/apache/dolphinscheduler/pull/17666)
3838
* Add table t_ds_serial_command. ([#17531])(https://github.com/apache/dolphinscheduler/pull/17531)
39+
* Remove the default value of `python-gateway.auth-token` at `api-server/application.yaml`. ([#17801])(https://github.com/apache/dolphinscheduler/pull/17801)
3940

dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/configuration/ApiConfig.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,15 @@
1717

1818
package org.apache.dolphinscheduler.api.configuration;
1919

20+
import org.apache.commons.lang3.StringUtils;
21+
2022
import java.util.HashMap;
2123
import java.util.Map;
2224

2325
import lombok.AllArgsConstructor;
2426
import lombok.Data;
2527
import lombok.NoArgsConstructor;
28+
import lombok.ToString;
2629
import lombok.extern.slf4j.Slf4j;
2730

2831
import org.springframework.boot.context.properties.ConfigurationProperties;
@@ -53,9 +56,16 @@ public boolean supports(Class<?> clazz) {
5356

5457
@Override
5558
public void validate(Object target, Errors errors) {
59+
validatePythonGateway(errors);
5660
printConfig();
5761
}
5862

63+
private void validatePythonGateway(Errors errors) {
64+
if (pythonGateway.isEnabled() && StringUtils.isEmpty(pythonGateway.getAuthToken())) {
65+
errors.rejectValue("pythonGateway.auth-token", null, "should not be empty when enabled is true");
66+
}
67+
}
68+
5969
private void printConfig() {
6070
log.info("API config: baseUrl -> {} ", baseUrl);
6171
log.info("API config: uiUrl -> {} ", uiUrl);
@@ -76,12 +86,13 @@ public static class TrafficConfiguration {
7686
private Map<String, Integer> customizeTenantQpsRate = new HashMap<>();
7787
}
7888

89+
@ToString(exclude = "authToken")
7990
@Data
8091
@NoArgsConstructor
8192
@AllArgsConstructor
8293
public static class PythonGatewayConfiguration {
8394

84-
private boolean enabled = true;
95+
private boolean enabled = false;
8596
private String gatewayServerAddress = "0.0.0.0";
8697
private int gatewayServerPort = 25333;
8798
private String pythonAddress = "127.0.0.1";

dolphinscheduler-api/src/main/resources/application.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,8 @@ api:
154154
python-gateway:
155155
# Weather enable python gateway server or not. The default value is false.
156156
enabled: false
157-
# Authentication token for connection from python api to python gateway server. Should be changed the default value
158-
# when you deploy in public network.
159-
auth-token: jwUDzpLsNKEFER4*a8gruBH_GsAurNxU7A@Xc
157+
# Authentication token for connection from python api to python gateway server. Should not be empty when enabled
158+
auth-token:
160159
# The address of Python gateway server start. Set its value to `0.0.0.0` if your Python API run in different
161160
# between Python gateway server. It could be be specific to other address like `127.0.0.1` or `localhost`
162161
gateway-server-address: 0.0.0.0

dolphinscheduler-standalone-server/src/main/resources/application.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,10 @@ api:
249249
#tenant1: 11
250250
#tenant2: 20
251251
python-gateway:
252-
# Weather enable python gateway server or not. The default value is true.
253-
enabled: true
254-
# Authentication token for connection from python api to python gateway server. Should be changed the default value
255-
# when you deploy in public network.
256-
auth-token: jwUDzpLsNKEFER4*a8gruBH_GsAurNxU7A@Xc
252+
# Weather enable python gateway server or not. The default value is false.
253+
enabled: false
254+
# Authentication token for connection from python api to python gateway server. Should not be empty when enabled
255+
auth-token:
257256
# The address of Python gateway server start. Set its value to `0.0.0.0` if your Python API run in different
258257
# between Python gateway server. It could be be specific to other address like `127.0.0.1` or `localhost`
259258
gateway-server-address: 0.0.0.0

0 commit comments

Comments
 (0)