This is an automated email from the ASF dual-hosted git repository.
xiaoyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new bcb795281f [type:feature] support docker env set http path (#5833)
bcb795281f is described below
commit bcb795281ff529375b479f546d078e8645332210
Author: aias00 <[email protected]>
AuthorDate: Wed Dec 4 14:13:23 2024 +0800
[type:feature] support docker env set http path (#5833)
Co-authored-by: xiaoyu <[email protected]>
---
.../org/apache/shenyu/admin/listener/ApplicationStartListener.java | 6 +++++-
.../src/main/java/org/apache/shenyu/common/constant/Constants.java | 5 +++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/ApplicationStartListener.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/ApplicationStartListener.java
index dc8a65439f..eb52fa8c51 100644
---
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/ApplicationStartListener.java
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/ApplicationStartListener.java
@@ -21,6 +21,7 @@ import jakarta.annotation.Resource;
import org.apache.commons.lang3.StringUtils;
import org.apache.shenyu.admin.mode.ShenyuRunningModeService;
import org.apache.shenyu.admin.utils.ShenyuDomain;
+import org.apache.shenyu.common.constant.Constants;
import org.apache.shenyu.common.utils.IpUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.context.WebServerInitializedEvent;
@@ -44,7 +45,10 @@ public class ApplicationStartListener implements
ApplicationListener<WebServerIn
public void onApplicationEvent(final WebServerInitializedEvent event) {
int port = event.getWebServer().getPort();
final String host = IpUtils.getHost();
- final String domain = System.getProperty("shenyu.httpPath");
+ String domain = System.getProperty(Constants.HTTP_PATH);
+ if (StringUtils.isBlank(domain)) {
+ domain = System.getenv(Constants.HTTP_PATH);
+ }
if (StringUtils.isBlank(domain)) {
ShenyuDomain.getInstance().setHttpPath("http://" +
String.join(":", host, String.valueOf(port)) + contextPath);
} else {
diff --git
a/shenyu-common/src/main/java/org/apache/shenyu/common/constant/Constants.java
b/shenyu-common/src/main/java/org/apache/shenyu/common/constant/Constants.java
index 794c625e12..77b0251588 100644
---
a/shenyu-common/src/main/java/org/apache/shenyu/common/constant/Constants.java
+++
b/shenyu-common/src/main/java/org/apache/shenyu/common/constant/Constants.java
@@ -921,6 +921,11 @@ public interface Constants {
*/
String EVENT_NAME_DATA = "data";
+ /**
+ * The constant EVENT_NAME_REGISTER.
+ */
+ String HTTP_PATH = "shenyu.httpPath";
+
/**
* String q.
*/