소스 검색

更改配置文件,分为生产、测试环境配置

wuhongshuang 3 년 전
부모
커밋
bd7bee064a
3개의 변경된 파일88개의 추가작업 그리고 69개의 파일을 삭제
  1. 1 1
      pom.xml
  2. 0 8
      src/main/resources/application.yml
  3. 87 60
      src/main/resources/bootstrap.yml

+ 1 - 1
pom.xml

@@ -236,7 +236,7 @@
 		</repository>
 		<repository>
 			<id>nexus</id>
-			<url>http://www.redouble.store:1888/repository/crbank-host/</url>
+			<url>http://120.25.151.99:1888/repository/crbank-host/</url>
 			<releases>
 				<enabled>true</enabled>
 			</releases>

+ 0 - 8
src/main/resources/application.yml

@@ -1,8 +0,0 @@
-swagger:
-  url: /v2/api-docs,/swagger-resources,/swagger-resources/**,/configuration/ui,/configuration/security,/swagger-ui.html/**,/webjars/**,/doc.html,/doc.html/**,/*.html,/**.html,/**/*.html,/**/*.css,/**/*.js,/sys/api/list,/sys/user/batch,/sys/org/batch
-logging:
-  file:
-    name: /app/applogs/${spring.application.name}/${spring.application.name}.log
-    path: /app/applogs/${spring.application.name}/${spring.application.name}.log
-    max-size: 100MB
-  level: info

+ 87 - 60
src/main/resources/bootstrap.yml

@@ -1,6 +1,9 @@
 spring:
   application:
     name: szwl-server
+  profiles:
+    # 打包时,换这里:sit测试,prod正式
+    active: sit
   cloud:
     config:
       name: szwl-server
@@ -8,41 +11,50 @@ spring:
         service-id: config-server
         # 是否获取配置中心配置
         enabled: true
-  datasource:
-    url: jdbc:mysql://rm-wz995mu26a1479kz0so.mysql.rds.aliyuncs.com:3306/szwl
-    username: root
-    password: sunzee@020
-    driver-class-name: com.mysql.jdbc.Driver
-#  stream:
-#      # 如果你项目里只对接一个中间件,那么不用定义binders
-#      # 当系统要定义多个不同消息中间件的时候,使用binders定义
-#      binders:
-#        my-rabbit:
-#          type: rabbit
-#          environment:
-#            spring:
-#              rabbitmq:
-#                addresses: 112.74.63.148:5672,120.78.140.173:5672,47.112.127.131:5672
-#                username: zwlzwlzwl
-#                password: 123456
-#                virtual-host: /
-#                publisher-confirms: true
-#                connection-timeout: 5s
-#                mandatory: true
-#                template.mandatory: true
-#                publisher-returns: true
-#                cache.channel.size: 1000
-#                concurrency: 500
-#                max-concurrency: 2000
-#                listener.simple.concurrency: 1000
-#                listener.simple.max-concurrency: 2000
-#spring:
+# 项目端口
+server:
+  port: 49011
+
+management:
+  endpoints:
+    web:
+      exposure:
+        include: refresh
+
+mybatis-plus:
+  mapper-locations: classpath:com/szwl/mapper/xml/*.xml
+
+swagger:
+  url: /v2/api-docs,/swagger-resources,/swagger-resources/**,/configuration/ui,/configuration/security,/swagger-ui.html/**,/webjars/**,/doc.html,/doc.html/**,/*.html,/**.html,/**/*.html,/**/*.css,/**/*.js,/sys/api/list,/sys/user/batch,/sys/org/batch
+
+#logging:
+#  level:
+#    com.szwl: debug
+logging:
+  file:
+    name: /app/applogs/${spring.application.name}/${spring.application.name}.log
+    path: /app/applogs/${spring.application.name}/${spring.application.name}.log
+    max-size: 100MB
+  level:
+    com.szwl: debug
+# es配置
+elasticSearch:
+  host: 120.78.140.173
+  #elasticSearch.host: 10.0.0.155
+  port: 9200
+  client.connectNum: 1000
+  connectPerRoute: 50
+  client.esUserName: elastic
+  client.esPassword: sunzee@020
+---
+# mq配置
+spring:
   rabbitmq:
     addresses: 112.74.63.148:5672,120.78.140.173:5672,47.112.127.131:5672
     username: zwlzwlzwl
     password: 123456
     virtual-host: /
-#    publisher-confirms: true
+    #    publisher-confirms: true
     connection-timeout: 5s
     mandatory: true
     template.mandatory: true
@@ -53,11 +65,46 @@ spring:
     listener.simple.concurrency: 1000
     listener.simple.max-concurrency: 2000
 
-#  redis:
-#    database: 0
-#    host: localhost         # Redis服务器地址
-#    port: 6379              # Redis服务器连接端口
-#    password:               # Redis服务器连接密码(默认为空)
+
+##上面是基础配置,不用上配置中心那种
+##下面是环境区分,主要不同环境不同文件获取
+---
+#测试环境
+spring:
+  profiles: sit
+#数据库配置
+  datasource:
+    url: jdbc:mysql://rm-wz995mu26a1479kz0so.mysql.rds.aliyuncs.com:3306/szwl-test
+    username: root
+    password: sunzee@020
+    driver-class-name: com.mysql.jdbc.Driver
+#redis配置
+  redis:
+    database: 0
+    host: 120.25.151.99         # Redis服务器地址
+    port: 63790              # Redis服务器连接端口
+    password:               # Redis服务器连接密码(默认为空)
+#注册中心
+eureka:
+  client:
+    serviceUrl:
+      defaultZone: http://120.25.151.99:49001/eureka/
+    register-with-eureka: true
+  instance:
+    prefer-ip-address: true
+  #    ip-address: 10.241.20.241
+
+---
+#正式环境
+spring:
+  profiles: prod
+  #数据库配置
+  datasource:
+    url: jdbc:mysql://rm-wz995mu26a1479kz0so.mysql.rds.aliyuncs.com:3306/szwl
+    username: root
+    password: sunzee@020
+    driver-class-name: com.mysql.jdbc.Driver
+  #redis配置
   redis:
     cluster:
       # 连接超时时间(毫秒)
@@ -66,7 +113,7 @@ spring:
       commandTimeout: 50000
       #集群配置
       nodes: 10.0.0.153:7000,10.0.0.153:7001,10.0.0.152:7001,10.0.0.152:7000,10.0.0.155:7001,10.0.0.155:7000
-#      nodes: 47.112.127.131:7000,47.112.127.131:7001,112.74.63.148:7001,112.74.63.148:7000,120.78.140.173:7001,120.78.140.173:7000
+      #      nodes: 47.112.127.131:7000,47.112.127.131:7001,112.74.63.148:7001,112.74.63.148:7000,120.78.140.173:7001,120.78.140.173:7000
       pool:
         # 连接池最大连接数(使用负值表示没有限制)
         max-active: 5000
@@ -76,36 +123,16 @@ spring:
         max-idle: 500
         # 连接池中的最小空闲连接
         min-idle: 5
-
-elasticSearch:
-  host: 120.78.140.173
-#elasticSearch.host: 10.0.0.155
-  port: 9200
-  client.connectNum: 1000
-  connectPerRoute: 50
-  client.esUserName: elastic
-  client.esPassword: sunzee@020
-server:
-  port: 49011
-
-management:
-  endpoints:
-    web:
-      exposure:
-        include: refresh
+#注册中心
 eureka:
   client:
-    service-url:
+    serviceUrl:
       defaultZone: http://112.74.63.148:49001/eureka/
     register-with-eureka: true
   instance:
     prefer-ip-address: true
-#    ip-address: 10.241.20.241
+  #    ip-address: 10.241.20.241
+
 
-mybatis-plus:
-  mapper-locations: classpath:com/szwl/mapper/xml/*.xml
 
-logging:
-  level:
-    com.szwl: debug