Browse Source

Enhance `StandaloneServer` so that we don't need to update the version number manually (#6074)

kezhenxu94 3 years ago
parent
commit
a06badba77

+ 10 - 0
dolphinscheduler-standalone-server/src/main/java/org/apache/dolphinscheduler/server/StandaloneServer.java

@@ -33,6 +33,7 @@ import org.apache.curator.test.TestingServer;
 import java.io.FileReader;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.nio.file.Paths;
 
 import javax.sql.DataSource;
 
@@ -71,6 +72,15 @@ public class StandaloneServer {
         final TestingServer server = new TestingServer(true);
         System.setProperty("registry.servers", server.getConnectString());
 
+        final Path registryPath = Paths.get(
+                StandaloneServer.class.getProtectionDomain().getCodeSource().getLocation().getPath(),
+                "../../../dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/pom.xml"
+        ).toAbsolutePath();
+        if (Files.exists(registryPath)) {
+            System.setProperty("registry.plugin.binding", registryPath.toString());
+            System.setProperty("registry.plugin.dir", "");
+        }
+
         Thread.currentThread().setName("Standalone-Server");
 
         new SpringApplicationBuilder(

+ 0 - 22
dolphinscheduler-standalone-server/src/main/resources/registry.properties

@@ -1,22 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# This file is only to override the production configurations in standalone server.
-
-registry.plugin.dir=./dolphinscheduler-dist/target/dolphinscheduler-dist-1.3.6-SNAPSHOT/lib/plugin/registry/zookeeper
-registry.plugin.name=zookeeper
-registry.servers=127.0.0.1:2181