Browse Source

区分本地和线上配置文件

master
liwenxuan 6 months ago
parent
commit
4a1046867f
  1. 8
      src/main/resources/application-dev.yml
  2. 119
      src/main/resources/application-prod.yml
  3. 2
      src/main/resources/application.yml

8
src/main/resources/application-dev.yml

@ -86,8 +86,8 @@ xxl:
admin: admin:
#调度中心部署地址,多个配置逗号分隔 "http://address01,http://address02" #调度中心部署地址,多个配置逗号分隔 "http://address01,http://address02"
#上线 #上线
#addresses: http://172.20.2.57:8080/xxl-job-admin addresses: http://172.20.2.57:8080/xxl-job-admin
addresses: http://127.0.0.1:8080/xxl-job-admin #addresses: http://127.0.0.1:8080/xxl-job-admin
#执行器token,非空时启用 xxl-job, access token #执行器token,非空时启用 xxl-job, access token
accessToken: data_upload accessToken: data_upload
executor: executor:
@ -108,8 +108,8 @@ xxl:
username: 10@ningyanghuagongchany20250508114250 username: 10@ningyanghuagongchany20250508114250
password: ce07f3c284084b42b674017b72fe73f2 password: ce07f3c284084b42b674017b72fe73f2
#上线 #上线
hostUrl: tcp://112.245.55.112:18183 #hostUrl: tcp://112.245.55.112:18183
#hostUrl: tcp://172.20.2.57:1883 hostUrl: tcp://172.20.2.57:1883
clientId: 10@ningyanghuagongchany20250508114250 clientId: 10@ningyanghuagongchany20250508114250
sensorDataTopic: /iot/10@ningyanghuagongchany20250422172632/thirdParty/sensorData sensorDataTopic: /iot/10@ningyanghuagongchany20250422172632/thirdParty/sensorData
timeout: 100 timeout: 100

119
src/main/resources/application-prod.yml

@ -0,0 +1,119 @@
#本地和内网配置
mybatis:
configuration:
#开启控制台打印sql
#log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# mybatis 下划线转驼峰配置,两者都可以
map-underscore-to-camel-case: true
# 一级缓存设置为 statement 级别,每次查询后清空缓存
local-cache-scope: statement
#全局关闭二级缓存
cache-enabled: false
#配置扫描
mapper-locations: classpath:mapper/*.xml
#配置xml的结果别名
type-aliases-package: com.hxjt.dataupload.model.entity
spring:
servlet:
multipart:
max-file-size: 10MB
max-request-size: 10MB
enabled: true
autoconfigure:
#去除durid配置
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
#druid多数据源配置(纯粹多库)
datasource:
dynamic:
datasource:
syncplant:
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
password: Syncp1@nt
#url: jdbc:sqlserver://172.20.2.206:1433;databaseName=SyncPlant;encrypt=true;trustServerCertificate=true
url: jdbc:sqlserver://172.20.2.206:1433;databaseName=SyncPlant
username: sa
hrnewlowcodeprod:
driver-class-name: com.mysql.cj.jdbc.Driver
password: kPMP6NafMsdccxDX
#url: jdbc:mysql://127.0.0.1:3306/hengxingaoke_tes?allowPublicKeyRetrieval=true&uuseUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&tinyInt1isBit=false
url: jdbc:mysql://36.133.126.182:3306/hr_new?allowPublicKeyRetrieval=true&uuseUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&tinyInt1isBit=false
username: hr_new
hrnewlowcodetest:
driver-class-name: com.mysql.cj.jdbc.Driver
password: 9z_Bu28r1*DZ3K6@+a
#url: jdbc:mysql://127.0.0.1:3306/hengxingaoke_tes?allowPublicKeyRetrieval=true&uuseUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&tinyInt1isBit=false
url: jdbc:mysql://172.20.5.33:4000/hr_new?allowPublicKeyRetrieval=true&uuseUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&tinyInt1isBit=false
username: root
hrnew87:
username: hr_new
password: AnknKiXiXaxNrw78
url: jdbc:mysql://172.20.2.87:3306/hr_new?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf8
#url: jdbc:mysql://127.0.0.1:3306/hr_new?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf8
#数据源基础配置
druid:
# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
# 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
filters: stat,wall
initial-size: 5
max-active: 20
#指定每个连接上PSCache的大小
max-pool-prepared-statement-per-connection-size: 20
# 配置获取连接等待超时的时间
max-wait: 6000
# 配置一个连接在池中最小生存的时间,单位是毫秒
min-evictable-idle-time-millis: 300000
min-idle: 5
# 打开PSCache
pool-prepared-statements: true
test-on-borrow: false
test-on-return: false
test-while-idle: true
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
time-between-eviction-runs-millis: 60000
validation-query: 'SELECT 1'
filter:
wall:
config:
comment-allow: true # 允许注释
db-type: sqlserver # 明确指定数据库类型
#指定默认数据源(必须配置)
primary: syncplant
#设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源.
strict: false
xxl:
job:
admin:
#调度中心部署地址,多个配置逗号分隔 "http://address01,http://address02"
#上线
#addresses: http://172.20.2.57:8080/xxl-job-admin
addresses: http://127.0.0.1:8080/xxl-job-admin
#执行器token,非空时启用 xxl-job, access token
accessToken: data_upload
executor:
# 执行器app名称,和控制台那边配置一样的名称,不然注册不上去
appname: data-upload
# [选填]执行器注册:优先使用该配置作为注册地址,为空时使用内嵌服务 ”IP:PORT“ 作为注册地址。
#从而更灵活的支持容器类型执行器动态IP和动态映射端口问题。
address:
#[选填]执行器IP :默认为空表示自动获取IP(即springboot容器的ip和端口,可以自动获取,也可以指定),多网卡时可手动设置指定IP,该IP不会绑定Host仅作为通讯实用;地址信息用于 "执行器注册" 和 "调度中心请求并触发任务",
ip:
# [选填]执行器端口号:小于等于0则自动获取;默认端口为9999,单机部署多个执行器时,注意要配置不同执行器端口;
port: 9998
#执行器日志文件存储路径,需要对该路径拥有读写权限;为空则使用默认路径
logpath: ./data/logs/xxl-job/executor
#执行器日志保存天数
logretentiondays: 30
mqtt:
username: 10@ningyanghuagongchany20250508114250
password: ce07f3c284084b42b674017b72fe73f2
#上线
hostUrl: tcp://112.245.55.112:18183
#hostUrl: tcp://172.20.2.57:1883
clientId: 10@ningyanghuagongchany20250508114250
sensorDataTopic: /iot/10@ningyanghuagongchany20250422172632/thirdParty/sensorData
timeout: 100
keepalive: 60
enabled: true
realtimeDataTopic: /iot/10@ningyanghuagongchany20250422172632/thirdParty/realtimeData

2
src/main/resources/application.yml

@ -1,5 +1,5 @@
spring: spring:
profiles: profiles:
active: dev active: prod
server: server:
port: 8118 port: 8118
Loading…
Cancel
Save