|
@@ -1,5 +1,6 @@
|
|
|
package cn.com.qmth.stmms.ms.commons.config;
|
|
|
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
@@ -27,14 +28,14 @@ public class ImageServerConfig {
|
|
|
private String dir;
|
|
|
|
|
|
public String getIp() {
|
|
|
- try {
|
|
|
+ /*try {
|
|
|
if (ip == null || ip.isEmpty()) {
|
|
|
ip = InetAddress.getLocalHost().getHostAddress();
|
|
|
|
|
|
}
|
|
|
} catch (UnknownHostException e) {
|
|
|
e.printStackTrace();
|
|
|
- }
|
|
|
+ }*/
|
|
|
return ip;
|
|
|
}
|
|
|
|
|
@@ -51,7 +52,7 @@ public class ImageServerConfig {
|
|
|
}
|
|
|
|
|
|
public String getPort() {
|
|
|
- return (port == null || port.isEmpty()) ? "3000" : port;
|
|
|
+ return port;
|
|
|
}
|
|
|
|
|
|
public void setPort(String port) {
|
|
@@ -60,9 +61,13 @@ public class ImageServerConfig {
|
|
|
|
|
|
public String getImageServer() {
|
|
|
if (aliyunOss) {
|
|
|
- return aliYunOssConfig.getUrl() + File.separator + this.getDir() + File.separator+ "upload";
|
|
|
+ return aliYunOssConfig.getUrl() + File.separator + this.getDir() + File.separator + "upload";
|
|
|
} else {
|
|
|
- return "http://" + this.getIp() + ":" + this.getPort() + File.separator + "upload";
|
|
|
+ if(StringUtils.isNotBlank(ip) && StringUtils.isNotBlank(port)){
|
|
|
+ return "http://" + this.getIp() + ":" + this.getPort() + File.separator + "upload";
|
|
|
+ } else {
|
|
|
+ return "upload";
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|