From 1b3869054544e19bba483e308620de4bac4a6401 Mon Sep 17 00:00:00 2001 From: liyongde <1419499670@qq.com> Date: Wed, 5 Jun 2024 20:18:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=95=B4=E7=90=86=EF=BC=8C=E5=B0=86=E9=9C=80=E8=A6=81=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E7=9A=84=E7=BB=9F=E4=B8=80=E6=8C=AA=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/config/application-dev.yml | 143 +------------ .../resources/config/application-prod.yml | 194 +++--------------- .../src/main/resources/config/application.yml | 124 ++++++++++- 3 files changed, 147 insertions(+), 314 deletions(-) diff --git a/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml b/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml index 6be5b27ad..5dfdea95b 100644 --- a/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml +++ b/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml @@ -26,143 +26,6 @@ nl: username: sa password: 123 database: 马钢_RH -# 配置数据源 -spring: - autoconfigure: - exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure - datasource: - dynamic: - primary: mysql - datasource: - mysql: - driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy - url: jdbc:log4jdbc:mysql://${DB_HOST:${nl.config.mysql.ip}}:${DB_PORT:${nl.config.mysql.port}}/${DB_NAME:${nl.config.mysql.database}}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true - username: ${DB_USER:${nl.config.mysql.username}} - password: ${DB_PWD:${nl.config.mysql.password}} - type: com.alibaba.druid.pool.DruidDataSource - oracle: - driver-class-name: oracle.jdbc.OracleDriver - url: jdbc:oracle:thin:@${nl.config.oracle.ip}:${nl.config.oracle.port}:${nl.config.oracle.scheme} - username: ${DB_USER:${nl.config.oracle.username}} - password: ${DB_PWD:${nl.config.oracle.password}} - type: com.alibaba.druid.pool.DruidDataSource - sqlserver: - driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver - url: jdbc:sqlserver://${nl.config.sqlserver.ip}\${nl.config.sqlserver.port};DatabaseName=${nl.config.sqlserver.database} - username: ${DB_USER:${nl.config.sqlserver.username}} - password: ${DB_PWD:${nl.config.sqlserver.password}} - type: com.alibaba.druid.pool.DruidDataSource - redis: - # 数据库索引 - host: ${REDIS_HOST:${nl.config.redis.ip}} - port: ${REDIS_PORT:${nl.config.redis.port}} - password: ${REDIS_PWD:${nl.config.redis.password}} - redisson: - config: | - threads: 4 - nettyThreads: 4 - singleServerConfig: - database: 3 - connectionMinimumIdleSize: 8 - connectionPoolSize: 8 - address: redis://127.0.0.1:6379 - idleConnectionTimeout: 10000 - timeout: 3000 -jetcache: - statIntervalMinutes: 15 - areaInCacheName: false - local: - default: - type: linkedhashmap - keyConvertor: fastjson - remote: - default: - type: redis - keyConvertor: fastjson2 - broadcastChannel: projectA - valueEncoder: java - valueDecoder: java - poolConfig: - minIdle: 5 - maxIdle: 20 - maxTotal: 50 - host: ${nl.config.redis.ip} - port: ${nl.config.redis.port} -#是否允许生成代码,生产环境设置为false -generator: - enabled: true -# IP 本地解析 -ip: - local-parsing: true - -# 文件存储路径 -file: - mac: - path: ~/file/ - avatar: ~/avatar/ - linux: - path: /home/eladmin/file/ - avatar: /home/eladmin/avatar/ - windows: - path: C:\eladmin\file\ - avatar: C:\eladmin\avatar\ - # 文件大小 /M - maxSize: 100 - avatarMaxSize: 5 -logging: - file: - path: C:\log\wms - config: classpath:logback-spring.xml - -# Sa-Token配置 -sa-token: - # token 名称 (同时也是cookie名称) - token-name: Authorization - # token 有效期,单位s 默认30天, -1代表永不过期 - timeout: 2592000 - # token 临时有效期 (指定时间内无操作就视为token过期) 单位: 秒 - activity-timeout: -1 - # 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录) - is-concurrent: true - # 在多人登录同一账号时,是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token) - is-share: false - # token风格 - token-style: random-128 - # 是否输出操作日志 - is-log: false - jwt-secret-key: opsjajisdnnca0sdkksdfaaasdfwwq - # token 前缀 - token-prefix: Bearer - sso: - # Ticket有效期 (单位: 秒),默认五分钟 - ticket-timeout: 300 - # 所有允许的授权回调地址 - allow-url: "*" - # 是否打开单点注销功能 - is-slo: true - - # ------- SSO-模式三相关配置 (下面的配置在SSO模式三并且 is-slo=true 时打开) - # 是否打开模式三 - isHttp: true - # 接口调用秘钥(用于SSO模式三的单点注销功能) - secretkey: kQwIOrYvnXmSDkwEiFngrKidMcdrgKor - # ---- 除了以上配置项,你还需要为 Sa-Token 配置http请求处理器(文档有步骤说明) - is-read-cookie: true - is-print: false -# 未登录 StpUtil.getTokenSession() 设置值,获取值 @SaIgnore 得忽略接口 - token-session-check-login: false - alone-redis: - # Redis数据库索引(默认为0) - database: ${nl.config.redis.database} - # Redis服务器地址 - host: ${nl.config.redis.ip} - # Redis服务器连接端口 - port: ${nl.config.redis.port} - # Redis服务器连接密码(默认为空) - password: - # 连接超时时间 - timeout: 10s - -lucene: - index: - path: D:\lucene\index + logging-path: C:\log\wms + lucene-path: D:\lucene\index + dynamic-log-path: C:\log\lms diff --git a/nladmin-system/nlsso-server/src/main/resources/config/application-prod.yml b/nladmin-system/nlsso-server/src/main/resources/config/application-prod.yml index bcea571e7..5dfdea95b 100644 --- a/nladmin-system/nlsso-server/src/main/resources/config/application-prod.yml +++ b/nladmin-system/nlsso-server/src/main/resources/config/application-prod.yml @@ -1,165 +1,31 @@ server: - port: 8010 -#配置数据源 -spring: - autoconfigure: - exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure - datasource: - dynamic: - primary: mysql - datasource: - mysql: - driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy - url: jdbc:log4jdbc:mysql://${DB_HOST:10.93.41.198}:${DB_PORT:3306}/${DB_NAME:lz_lms_two}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true - username: ${DB_USER:root} - password: ${DB_PWD:123456} -# url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:rtmg_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true -# username: ${DB_USER:root} -# password: ${DB_PWD:12356} - type: com.alibaba.druid.pool.DruidDataSource - oracle: - driver-class-name: oracle.jdbc.OracleDriver - url: jdbc:oracle:thin:@172.27.37.66:1521:RTMES - username: ${DB_USER:LMSTELCOM} - password: ${DB_PWD:LMSTELCOM_6463} - type: com.alibaba.druid.pool.DruidDataSource - sqlserver: - driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver - url: jdbc:sqlserver://10.93.41.2\WINCC;DatabaseName=马钢_RH - username: ${DB_USER:sa} - password: ${DB_PWD:123} - type: com.alibaba.druid.pool.DruidDataSource - redis: - #数据库索引 - host: ${REDIS_HOST:127.0.0.1} - port: ${REDIS_PORT:6379} - password: ${REDIS_PWD:} - redisson: - config: | - threads: 4 - nettyThreads: 4 - singleServerConfig: - database: 15 - connectionMinimumIdleSize: 8 - connectionPoolSize: 8 - address: redis://127.0.0.1:6379 - idleConnectionTimeout: 10000 - timeout: 3000 -# 登录相关配置 -login: - # 登录缓存 - cache-enable: true - # 是否限制单用户登录 - single-login: false - # 验证码 - login-code: - # 验证码类型配置 查看 LoginProperties 类 - code-type: arithmetic - # 登录图形验证码有效时间/分钟 - expiration: 2 - # 验证码高度 - width: 111 - # 验证码宽度 - heigth: 36 - # 内容长度 - length: 2 - # 字体名称,为空则使用默认字体,如遇到线上乱码,设置其他字体即可 - font-name: - # 字体大小 - font-size: 25 - -#jwt -jwt: - header: Authorization - # 令牌前缀 - token-start-with: Bearer - # 必须使用最少88位的Base64对该令牌进行编码 - base64-secret: ZmQ0ZGI5NjQ0MDQwY2I4MjMxY2Y3ZmI3MjdhN2ZmMjNhODViOTg1ZGE0NTBjMGM4NDA5NzYxMjdjOWMwYWRmZTBlZjlhNGY3ZTg4Y2U3YTE1ODVkZDU5Y2Y3OGYwZWE1NzUzNWQ2YjFjZDc0NGMxZWU2MmQ3MjY1NzJmNTE0MzI= - # 令牌过期时间 此处单位/毫秒 ,默认2小时,可在此网站生成 https://www.convertworld.com/zh-hans/time/milliseconds.html - token-validity-in-seconds: 7200000 - # 在线用户key - online-key: online-token- - # 验证码 - code-key: code-key- - # token 续期检查时间范围(默认30分钟,单位默认毫秒),在token即将过期的一段时间内用户操作了,则给用户的token续期 - detect: 1800000 - # 续期时间范围,默认 1小时,这里单位毫秒 - renew: 3600000 - -# IP 本地解析 -ip: - local-parsing: true - -#是否允许生成代码,生产环境设置为false -generator: - enabled: false -# 文件存储路径 -file: - mac: - path: ~/file/ - avatar: ~/avatar/ - linux: - path: /home/eladmin/file/ - avatar: /home/eladmin/avatar/ - windows: - path: C:\eladmin\file\ - avatar: C:\eladmin\avatar\ - # 文件大小 /M - maxSize: 100 - avatarMaxSize: 5 -logging: - file: - path: /app/jar/logs - config: classpath:logback-spring.xml - -# Sa-Token配置 -sa-token: - # token 名称 (同时也是cookie名称) - token-name: Authorization - # token 有效期,单位s 默认30天, -1代表永不过期 - timeout: 2592000 - # token 临时有效期 (指定时间内无操作就视为token过期) 单位: 秒 - activity-timeout: -1 - # 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录) - is-concurrent: true - # 在多人登录同一账号时,是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token) - is-share: false - # token风格 - token-style: random-128 - # 是否输出操作日志 - is-log: false - jwt-secret-key: opsjajisdnnca0sdkksdfaaasdfwwq - # token 前缀 - token-prefix: Bearer - sso: - # Ticket有效期 (单位: 秒),默认五分钟 - ticket-timeout: 300 - # 所有允许的授权回调地址 - allow-url: "*" - # 是否打开单点注销功能 - is-slo: true - - # ------- SSO-模式三相关配置 (下面的配置在SSO模式三并且 is-slo=true 时打开) - # 是否打开模式三 - isHttp: true - # 接口调用秘钥(用于SSO模式三的单点注销功能) - secretkey: kQwIOrYvnXmSDkwEiFngrKidMcdrgKor - # ---- 除了以上配置项,你还需要为 Sa-Token 配置http请求处理器(文档有步骤说明) - is-read-cookie: true - is-print: false - # 未登录 StpUtil.getTokenSession() 设置值,获取值 @SaIgnore 得忽略接口 - token-session-check-login: false - alone-redis: - # Redis数据库索引(默认为0) - database: 9 - # Redis服务器地址 - host: 127.0.0.1 - # Redis服务器连接端口 - port: 6379 - # Redis服务器连接密码(默认为空) - password: - # 连接超时时间 - timeout: 10s -lucene: - index: - path: D:\lucene\index + port: 8011 +# 项目配置 +nl: + config: + mysql: + ip: 127.0.0.1 + port: 3306 + username: root + password: 12356 + database: nl-platform + redis: + ip: 127.0.0.1 + port: 6379 + password: null + database: 1 + oracle: + ip: 172.27.37.66 + port: 1521 + scheme: RTMES + username: LMSTELCOM + password: LMSTELCOM_6463 + sqlserver: + ip: 10.93.41.2 + port: WINCC + username: sa + password: 123 + database: 马钢_RH + logging-path: C:\log\wms + lucene-path: D:\lucene\index + dynamic-log-path: C:\log\lms diff --git a/nladmin-system/nlsso-server/src/main/resources/config/application.yml b/nladmin-system/nlsso-server/src/main/resources/config/application.yml index 121537a48..61e42927c 100644 --- a/nladmin-system/nlsso-server/src/main/resources/config/application.yml +++ b/nladmin-system/nlsso-server/src/main/resources/config/application.yml @@ -4,6 +4,10 @@ server: relaxed-path-chars: [ '|','{','}','[',']' ] #字符问题: https://blog.csdn.net/weixin_41996632/article/details/90715118 spring: + profiles: + active: dev + autoconfigure: + exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure messages: basename: language/login/login,language/error/error,language/buss/buss,language/task/task datasource: @@ -46,23 +50,58 @@ spring: url-pattern: /druid/* login-username: admin login-password: admin + dynamic: + primary: mysql + datasource: + mysql: + driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy + url: jdbc:log4jdbc:mysql://${DB_HOST:${nl.config.mysql.ip}}:${DB_PORT:${nl.config.mysql.port}}/${DB_NAME:${nl.config.mysql.database}}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true + username: ${DB_USER:${nl.config.mysql.username}} + password: ${DB_PWD:${nl.config.mysql.password}} + type: com.alibaba.druid.pool.DruidDataSource + oracle: + driver-class-name: oracle.jdbc.OracleDriver + url: jdbc:oracle:thin:@${nl.config.oracle.ip}:${nl.config.oracle.port}:${nl.config.oracle.scheme} + username: ${DB_USER:${nl.config.oracle.username}} + password: ${DB_PWD:${nl.config.oracle.password}} + type: com.alibaba.druid.pool.DruidDataSource + sqlserver: + driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver + url: jdbc:sqlserver://${nl.config.sqlserver.ip}\${nl.config.sqlserver.port};DatabaseName=${nl.config.sqlserver.database} + username: ${DB_USER:${nl.config.sqlserver.username}} + password: ${DB_PWD:${nl.config.sqlserver.password}} + type: com.alibaba.druid.pool.DruidDataSource freemarker: check-template-location: false - profiles: - active: dev jackson: time-zone: GMT+8 data: redis: repositories: enabled: false + redis: + # 数据库索引 + host: ${REDIS_HOST:${nl.config.redis.ip}} + port: ${REDIS_PORT:${nl.config.redis.port}} + password: ${REDIS_PWD:${nl.config.redis.password}} + redisson: + config: | + threads: 4 + nettyThreads: 4 + singleServerConfig: + database: 3 + connectionMinimumIdleSize: 8 + connectionPoolSize: 8 + address: redis://127.0.0.1:6379 + idleConnectionTimeout: 10000 + timeout: 3000 dynamic: tp: enabled: true # 是否启用 dynamictp,默认true enabledBanner: false # 是否启用 控制台banner,默认true enabledCollect: true # 是否开启监控指标采集,默认true collectorTypes: logging,test_collect # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer - logPath: C:\log\lms # 监控日志数据路径,默认 ${user.home}/logs,采集类型非logging不用配置 + logPath: ${nl.config.dynamic-log-path} # 监控日志数据路径,默认 ${user.home}/logs,采集类型非logging不用配置 monitorInterval: 8 tomcatTp: # tomcat webserver 线程池配置 threadPoolAliasName: tomcat 线程池 # 线程池别名,可选 @@ -116,9 +155,29 @@ login: #密码加密传输,前端公钥加密,后端私钥解密 rsa: private_key: MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8mp0f3FE0GYP3AYPaJF7jUd1M0XxFSE2ceK3k2kw20YvQ09NJKk+OMjWQl9WitG9pB6tSCQIDAQABAkA2SimBrWC2/wvauBuYqjCFwLvYiRYqZKThUS3MZlebXJiLB+Ue/gUifAAKIg1avttUZsHBHrop4qfJCwAI0+YRAiEA+W3NK/RaXtnRqmoUUkb59zsZUBLpvZgQPfj1MhyHDz0CIQDYhsAhPJ3mgS64NbUZmGWuuNKp5coY2GIj/zYDMJp6vQIgUueLFXv/eZ1ekgz2Oi67MNCk5jeTF2BurZqNLR3MSmUCIFT3Q6uHMtsB9Eha4u7hS31tj1UWE+D+ADzp59MGnoftAiBeHT7gDMuqeJHPL4b+kC+gzV4FGTfhR9q3tTbklZkD2A== +#是否允许生成代码,生产环境设置为false +generator: + enabled: true +# IP 本地解析 +ip: + local-parsing: true +# 文件存储路径 +file: + mac: + path: ~/file/ + avatar: ~/avatar/ + linux: + path: /home/eladmin/file/ + avatar: /home/eladmin/avatar/ + windows: + path: C:\eladmin\file\ + avatar: C:\eladmin\avatar\ + # 文件大小 /M + maxSize: 100 + avatarMaxSize: 5 logging: file: - path: C:\log\wms + path: ${nl.config.logging-path} config: classpath:logback-spring.xml # sa-token白名单配置 security: @@ -164,7 +223,8 @@ mybatis-plus: banner: false lucene: index: - path: D:\lucene\index + path: ${nl.config.lucene-path} +# Sa-Token配置 sa-token: # token 名称 (同时也是cookie名称) token-name: Authorization @@ -182,9 +242,53 @@ sa-token: is-log: false jwt-secret-key: opsjajisdnnca0sdkksdfaaasdfwwq # token 前缀 - token-prefix: - cookie: - # 配置 Cookie 作用域:根据二级域名实现sso登入如lms.sso.com;acs.sso.com - domain: - is-read-cookie: false + token-prefix: Bearer + sso: + # Ticket有效期 (单位: 秒),默认五分钟 + ticket-timeout: 300 + # 所有允许的授权回调地址 + allow-url: "*" + # 是否打开单点注销功能 + is-slo: true + + # ------- SSO-模式三相关配置 (下面的配置在SSO模式三并且 is-slo=true 时打开) + # 是否打开模式三 + isHttp: true + # 接口调用秘钥(用于SSO模式三的单点注销功能) + secretkey: kQwIOrYvnXmSDkwEiFngrKidMcdrgKor + # ---- 除了以上配置项,你还需要为 Sa-Token 配置http请求处理器(文档有步骤说明) + is-read-cookie: true is-print: false + # 未登录 StpUtil.getTokenSession() 设置值,获取值 @SaIgnore 得忽略接口 + token-session-check-login: false + alone-redis: + # Redis数据库索引(默认为0) + database: ${nl.config.redis.database} + # Redis服务器地址 + host: ${nl.config.redis.ip} + # Redis服务器连接端口 + port: ${nl.config.redis.port} + # Redis服务器连接密码(默认为空) + password: + # 连接超时时间 + timeout: 10s +jetcache: + statIntervalMinutes: 15 + areaInCacheName: false + local: + default: + type: linkedhashmap + keyConvertor: fastjson + remote: + default: + type: redis + keyConvertor: fastjson2 + broadcastChannel: projectA + valueEncoder: java + valueDecoder: java + poolConfig: + minIdle: 5 + maxIdle: 20 + maxTotal: 50 + host: ${nl.config.redis.ip} + port: ${nl.config.redis.port}