feat: enable load local application yaml config
This commit is contained in:
@@ -18,6 +18,8 @@ docker_my_conf_file=${docker_mysql_conf_d}/my.cnf
|
||||
wfc_jar_images=$(docker images --format "{{.Repository}}"|grep -E "docker-wfc-|docker_wfc-")
|
||||
wfc_modules_images=$(docker images --format "{{.Repository}}"|grep -E "docker-wfc-modules-|docker_wfc-modules-")
|
||||
|
||||
conf_dirs="${docker_work_dir}/conf ${docker_work_dir}/wfc/modules/system/conf ${docker_work_dir}/wfc/modules/user/conf ${docker_work_dir}/wfc/modules/job/conf ${docker_work_dir}/wfc/modules/file/conf ${docker_work_dir}/wfc/modules/payment/conf"
|
||||
|
||||
case "$1" in
|
||||
env)
|
||||
# prepare directory
|
||||
@@ -52,6 +54,25 @@ case "$1" in
|
||||
cp ${def_env_file} ${org_env_file}
|
||||
fi
|
||||
|
||||
# copy default config files to conf directory
|
||||
for conf_dir in $conf_dirs; do
|
||||
if [ ! -d $conf_dir ]; then
|
||||
continue
|
||||
fi
|
||||
if [ ! -d $conf_dir/default ]; then
|
||||
continue
|
||||
fi
|
||||
# 遍历default目录下的文件
|
||||
for file in "$conf_dir/default"/*; do
|
||||
filename=$(basename "$file")
|
||||
|
||||
# 如果conf目录下不存在相应的文件,则拷贝
|
||||
if [ ! -f "$conf_dir/$filename" ]; then
|
||||
cp "$file" "$conf_dir/"
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
if [ ! -z "${new_ip}" ]; then
|
||||
# 使用sed命令替换IP地址
|
||||
# 替换.env文件
|
||||
|
||||
45
build/docker/conf/default/application-common.yml
Normal file
45
build/docker/conf/default/application-common.yml
Normal file
@@ -0,0 +1,45 @@
|
||||
spring:
|
||||
autoconfigure:
|
||||
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
|
||||
mvc:
|
||||
pathmatch:
|
||||
matching-strategy: ant_path_matcher
|
||||
# 资源信息
|
||||
messages:
|
||||
# 国际化资源文件路径
|
||||
basename: i18n/messages
|
||||
|
||||
# feign 配置
|
||||
feign:
|
||||
sentinel:
|
||||
enabled: true
|
||||
okhttp:
|
||||
enabled: false
|
||||
httpclient:
|
||||
enabled: true
|
||||
disable-ssl-validation: true
|
||||
client:
|
||||
config:
|
||||
default:
|
||||
connectTimeout: 60000
|
||||
readTimeout: 60000
|
||||
compression:
|
||||
request:
|
||||
enabled: true
|
||||
min-request-size: 8192
|
||||
response:
|
||||
enabled: true
|
||||
|
||||
# 暴露监控端点
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: '*'
|
||||
|
||||
# Omada 配置
|
||||
omada:
|
||||
omada-url: 'https://192.168.2.249:8043'
|
||||
omadac-id: 'f3aa6e479b94222581523710cc2c2a9d'
|
||||
client-id: '5036e77c81a74008821c694a715fe2b8'
|
||||
client-secret: '29faa06fb7f244b094377b48eb3083a7'
|
||||
@@ -155,6 +155,8 @@ services:
|
||||
- wfc-be-network
|
||||
volumes:
|
||||
- ./wfc/modules/system/jar/wfc-modules-system.jar:/opt/wfc/app.jar
|
||||
- ./wfc/modules/system/conf/application.yml:/opt/wfc/conf/application.yml
|
||||
- ./conf/application-common.yml:/opt/wfc/conf/application-common.yml
|
||||
depends_on:
|
||||
wfc-redis:
|
||||
condition: service_healthy
|
||||
@@ -190,6 +192,8 @@ services:
|
||||
- wfc-be-network
|
||||
volumes:
|
||||
- ./wfc/modules/user/jar/wfc-modules-user.jar:/opt/wfc/app.jar
|
||||
- ./wfc/modules/user/conf/application.yml:/opt/wfc/conf/application.yml
|
||||
- ./conf/application-common.yml:/opt/wfc/conf/application-common.yml
|
||||
depends_on:
|
||||
wfc-redis:
|
||||
condition: service_healthy
|
||||
|
||||
@@ -5,7 +5,7 @@ WORKDIR /opt/wfc
|
||||
|
||||
# 设置环境变量
|
||||
ENV JVM_OPTS="-Xms128m -Xmx512m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m"
|
||||
ENV JAVA_OPTS=""
|
||||
ENV JAVA_OPTS="--spring.config.additional-location=/opt/wfc/conf/application.yml""
|
||||
ENV JAR_FILE="app.jar"
|
||||
|
||||
# 使用 sh -c 解析环境变量
|
||||
|
||||
@@ -64,10 +64,3 @@ server:
|
||||
enabled: true
|
||||
pattern: '%h %l %u %t "%r" %s %b %D %{User-Agent}i %{Request-Source}i'
|
||||
basedir: /home/wfc/nacos/tomcat/logs
|
||||
|
||||
# Omada 配置
|
||||
omada:
|
||||
omada-url: 'https://192.168.2.249:8043'
|
||||
omadac-id: 'f3aa6e479b94222581523710cc2c2a9d'
|
||||
client-id: '5036e77c81a74008821c694a715fe2b8'
|
||||
client-secret: '29faa06fb7f244b094377b48eb3083a7'
|
||||
58
build/docker/wfc/modules/system/conf/default/application.yml
Normal file
58
build/docker/wfc/modules/system/conf/default/application.yml
Normal file
@@ -0,0 +1,58 @@
|
||||
# spring配置
|
||||
spring:
|
||||
redis:
|
||||
host: wfc-redis
|
||||
port: 6379
|
||||
password:
|
||||
datasource:
|
||||
druid:
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
loginUsername: admin
|
||||
loginPassword: 123456
|
||||
dynamic:
|
||||
druid:
|
||||
initial-size: 5
|
||||
min-idle: 5
|
||||
maxActive: 20
|
||||
maxWait: 60000
|
||||
connectTimeout: 30000
|
||||
socketTimeout: 60000
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
validationQuery: SELECT 1 FROM DUAL
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
poolPreparedStatements: true
|
||||
maxPoolPreparedStatementPerConnectionSize: 20
|
||||
filters: stat,slf4j
|
||||
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
|
||||
datasource:
|
||||
# 主库数据源
|
||||
master:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://wfc-mysql:3306/wfc_system_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: 123456
|
||||
# 从库数据源
|
||||
# slave:
|
||||
# username:
|
||||
# password:
|
||||
# url:
|
||||
# driver-class-name:
|
||||
config:
|
||||
import: classpath:application-common.yml
|
||||
|
||||
# mybatis配置
|
||||
mybatis:
|
||||
# 搜索指定包别名
|
||||
typeAliasesPackage: org.wfc.system
|
||||
# 配置mapper的扫描,找到所有的mapper.xml映射文件
|
||||
mapperLocations: classpath:mapper/**/*.xml
|
||||
|
||||
# swagger配置
|
||||
swagger:
|
||||
title: 系统模块接口文档
|
||||
license: Powered By wfc
|
||||
licenseUrl: https://wfc.vip
|
||||
66
build/docker/wfc/modules/user/conf/default/application.yml
Normal file
66
build/docker/wfc/modules/user/conf/default/application.yml
Normal file
@@ -0,0 +1,66 @@
|
||||
# spring配置
|
||||
spring:
|
||||
redis:
|
||||
host: wfc-redis
|
||||
port: 6379
|
||||
password:
|
||||
datasource:
|
||||
druid:
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
loginUsername: admin
|
||||
loginPassword: 123456
|
||||
dynamic:
|
||||
druid:
|
||||
initial-size: 5
|
||||
min-idle: 5
|
||||
maxActive: 20
|
||||
maxWait: 60000
|
||||
connectTimeout: 30000
|
||||
socketTimeout: 60000
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
validationQuery: SELECT 1 FROM DUAL
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
poolPreparedStatements: true
|
||||
maxPoolPreparedStatementPerConnectionSize: 20
|
||||
filters: stat,slf4j
|
||||
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
|
||||
datasource:
|
||||
# 主库数据源
|
||||
master:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://wfc-mysql:3306/wfc_user_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: 123456
|
||||
# 从库数据源
|
||||
# slave:
|
||||
# username:
|
||||
# password:
|
||||
# url:
|
||||
# driver-class-name:
|
||||
config:
|
||||
import: classpath:application-common.yml
|
||||
|
||||
# mybatis配置
|
||||
mybatis:
|
||||
# 搜索指定包别名
|
||||
typeAliasesPackage: org.wfc.user
|
||||
config-location: classpath:mybatis-config.xml
|
||||
# 配置mapper的扫描,找到所有的mapper.xml映射文件
|
||||
mapperLocations: classpath:mapper/**/*.xml
|
||||
|
||||
# swagger配置
|
||||
swagger:
|
||||
title: 系统模块接口文档
|
||||
license: Powered By wfc
|
||||
licenseUrl: https://wfc.vip
|
||||
|
||||
logging:
|
||||
level:
|
||||
root: INFO
|
||||
org.springframework.web: INFO
|
||||
org.mybatis.mapper: DEBUG
|
||||
org.wfc.user: DEBUG
|
||||
Reference in New Issue
Block a user