生产环境配置,访问文件ip配置

master
cheney 2 years ago
parent a34138190d
commit 4992c36aed
  1. 9
      src/main/java/com/huoran/iasf/common/config/FileUploadProperties.java
  2. 4
      src/main/java/com/huoran/iasf/service/impl/SysFilesServiceImpl.java
  3. 14
      src/main/resources/application-dev.yml
  4. 26
      src/main/resources/application-prod.yml

@ -16,6 +16,7 @@ import org.springframework.util.StringUtils;
public class FileUploadProperties {
private String path;
private String ip;
private String url;
private String accessUrl;
@ -28,6 +29,14 @@ public class FileUploadProperties {
this.path = path;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getUrl() {
return url;
}

@ -104,9 +104,9 @@ public class SysFilesServiceImpl extends ServiceImpl<SysFilesMapper, SysFilesEnt
sysFilesEntity.setType(fileCheck(suffixName));
this.save(sysFilesEntity);
// String hostAddress = InetAddress.getLocalHost().getHostAddress();
String hostAddress = getLocalHostExactAddress().getHostAddress();
// String hostAddress = getLocalHostExactAddress().getHostAddress();
// String url = fileUploadProperties.getUrl() + "/preview" + "/" + sysFilesEntity.getId();
String url = "http://" + hostAddress + fileUploadProperties.getUrl() + sysFilesEntity.getId();
String url = fileUploadProperties.getIp() + fileUploadProperties.getUrl() + sysFilesEntity.getId();
sysFilesEntity.setUrl(url);
this.updateById(sysFilesEntity);

@ -8,13 +8,15 @@ spring:
username: root
# password: 123456
password: iasf#2022
# password: HuoRan@2021
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/iasf?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=GMT%2b8
# url: jdbc:mysql://192.168.31.136:3306/iasf?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=GMT%2b8
# url: jdbc:mysql://127.0.0.1:3306/iasf?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=GMT%2b8
url: jdbc:mysql://192.168.31.136:3306/iasf?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=GMT%2b8
# url: jdbc:mysql://139.9.47.170:3306/iasf?serverTimezone=GMT%2B8
cache:
type: redis
redis:
host: localhost # Redis服务器地址
host: 127.0.0.1 # Redis服务器地址
database: 0 # Redis数据库索引(默认为0)
port: 6379 # Redis服务器连接端口
password: # Redis服务器连接密码(默认为空)
@ -31,11 +33,11 @@ singleServerConfig:
password:
file:
#文件上传目录 绝对路径 末尾请加 /
path: C:/files/ #windows
#path: /data/files/ #linux
#文件上传目录 绝对路径 末尾请加 / windows
path: C:/files/
#文件预览url
url: /iasf/sysFiles/preview/
ip: http://10.10.11.7
#本地开启
# url: :10000/iasf/sysFiles/preview/

@ -6,28 +6,34 @@ spring:
datasource:
master:
username: root
password: 123456
password: HuoRan@2021
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/iasf?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=GMT%2b8
url: jdbc:mysql://139.9.47.170:3306/iasf?serverTimezone=GMT%2B8
cache:
type: redis
redis:
host: localhost # Redis服务器地址
host: 127.0.0.1 # Redis服务器地址
database: 0 # Redis数据库索引(默认为0)
port: 6379 # Redis服务器连接端口
password: # Redis服务器连接密码(默认为空)
password: HuoRan@2021 # Redis服务器连接密码(默认为空)
jedis:
pool:
max-active: 8 # 连接池最大连接数(使用负值表示没有限制)
max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
max-idle: 8 # 连接池中的最大空闲连接
min-idle: 0 # 连接池中的最小空闲连接
timeout: 3000ms # 连接超时时间(毫秒
timeout: 3000ms # 连接超时时间(毫秒)
singleServerConfig:
address: "redis://127.0.0.1:6379"
password: HuoRan@2021
file:
#文件上传目录 绝对路径 末尾请加 /
path: D:/files/ #windows
#path: /data/files/ #linux
#文件预览、下载的url, 末尾请勿加 /
url: :10000/iasf/sysFiles/preview/
#文件上传目录 绝对路径 末尾请加 / linux
path: /usr/local/huoran/huorantech_website/files/
#文件预览url
url: /iasf/sysFiles/preview/
ip: http://139.159.254.212
knife4j:
production: true #生成环境禁用查看文档
Loading…
Cancel
Save