添加Spring Cloud Config配置中心支持
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package com.macro.mall;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.config.server.EnableConfigServer;
|
||||
|
||||
@EnableConfigServer
|
||||
@EnableDiscoveryClient
|
||||
@SpringBootApplication
|
||||
public class MallConfigApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MallConfigApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
16
mall-config/src/main/resources/application.yml
Normal file
16
mall-config/src/main/resources/application.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
server:
|
||||
port: 8301
|
||||
spring:
|
||||
application:
|
||||
name: mall-config
|
||||
profiles:
|
||||
active: native #使用本地配置
|
||||
cloud:
|
||||
config:
|
||||
server:
|
||||
native:
|
||||
search-locations: classpath:/config/{application}
|
||||
eureka:
|
||||
client:
|
||||
service-url:
|
||||
defaultZone: http://localhost:8001/eureka/
|
||||
21
mall-config/src/main/resources/config/admin/admin-dev.yml
Normal file
21
mall-config/src/main/resources/config/admin/admin-dev.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
aliyun:
|
||||
oss:
|
||||
endpoint: oss-cn-shenzhen.aliyuncs.com # oss对外服务的访问域名
|
||||
accessKeyId: test # 访问身份验证中用到用户标识
|
||||
accessKeySecret: test # 用户用于加密签名字符串和oss用来验证签名字符串的密钥
|
||||
bucketName: macro-oss # oss的存储空间
|
||||
policy:
|
||||
expire: 300 # 签名有效期(S)
|
||||
maxSize: 10 # 上传文件大小(M)
|
||||
callback: http://39.98.190.128:8080/aliyun/oss/callback # 文件上传成功后的回调地址
|
||||
dir:
|
||||
prefix: mall/images/ # 上传文件夹路径前缀
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://localhost:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: root
|
||||
logging:
|
||||
level:
|
||||
root: info #日志配置DEBUG,INFO,WARN,ERROR
|
||||
com.macro.mall: debug
|
||||
19
mall-config/src/main/resources/config/admin/admin-prod.yml
Normal file
19
mall-config/src/main/resources/config/admin/admin-prod.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
aliyun:
|
||||
oss:
|
||||
endpoint: oss-cn-shenzhen.aliyuncs.com # oss对外服务的访问域名
|
||||
accessKeyId: test # 访问身份验证中用到用户标识
|
||||
accessKeySecret: test # 用户用于加密签名字符串和oss用来验证签名字符串的密钥
|
||||
bucketName: macro-oss # oss的存储空间
|
||||
policy:
|
||||
expire: 300 # 签名有效期(S)
|
||||
maxSize: 10 # 上传文件大小(M)
|
||||
callback: http://39.98.190.128:8080/aliyun/oss/callback # 文件上传成功后的回调地址
|
||||
dir:
|
||||
prefix: mall/images/ # 上传文件夹路径前缀
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://db:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||
username: reader
|
||||
password: 123456
|
||||
logging:
|
||||
path: /var/logs #配置日志生成路径
|
||||
10
mall-config/src/main/resources/config/demo/demo-dev.yml
Normal file
10
mall-config/src/main/resources/config/demo/demo-dev.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://localhost:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: root
|
||||
logging:
|
||||
level:
|
||||
root: info #日志配置DEBUG,INFO,WARN,ERROR
|
||||
com.macro.mall: debug
|
||||
com.macro.mall.demo.service.FeignAdminService: debug
|
||||
7
mall-config/src/main/resources/config/demo/demo-prod.yml
Normal file
7
mall-config/src/main/resources/config/demo/demo-prod.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://db:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||
username: reader
|
||||
password: 123456
|
||||
logging:
|
||||
path: /var/logs #配置日志生成路径
|
||||
28
mall-config/src/main/resources/config/portal/portal-dev.yml
Normal file
28
mall-config/src/main/resources/config/portal/portal-dev.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://localhost:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: root
|
||||
data:
|
||||
mongodb:
|
||||
host: localhost
|
||||
port: 27017
|
||||
database: mall-port
|
||||
redis:
|
||||
host: localhost # Redis服务器地址
|
||||
database: 0 # Redis数据库索引(默认为0)
|
||||
port: 6379 # Redis服务器连接端口
|
||||
password: 123456 # Redis服务器连接密码(默认为空)
|
||||
rabbitmq:
|
||||
host: localhost
|
||||
port: 5672
|
||||
virtual-host: /mall
|
||||
username: mall
|
||||
password: mall
|
||||
publisher-confirms: true #如果对异步消息需要回调必须设置为true
|
||||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
org.springframework.data.mongodb.core: debug
|
||||
com.macro.mall.mapper: debug
|
||||
com.macro.mall.portal.dao: debug
|
||||
29
mall-config/src/main/resources/config/portal/portal-prod.yml
Normal file
29
mall-config/src/main/resources/config/portal/portal-prod.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://localhost:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: root
|
||||
data:
|
||||
mongodb:
|
||||
host: localhost
|
||||
port: 27017
|
||||
database: mall-port
|
||||
redis:
|
||||
host: localhost # Redis服务器地址
|
||||
database: 0 # Redis数据库索引(默认为0)
|
||||
port: 6379 # Redis服务器连接端口
|
||||
password: 123456 # Redis服务器连接密码(默认为空)
|
||||
rabbitmq:
|
||||
host: localhost
|
||||
port: 5672
|
||||
virtual-host: /mall
|
||||
username: mall
|
||||
password: mall
|
||||
publisher-confirms: true #如果对异步消息需要回调必须设置为true
|
||||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
org.springframework.data.mongodb.core: debug
|
||||
com.macro.mall.mapper: debug
|
||||
com.macro.mall.portal.dao: debug
|
||||
|
||||
13
mall-config/src/main/resources/config/search/search-dev.yml
Normal file
13
mall-config/src/main/resources/config/search/search-dev.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://localhost:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: root
|
||||
data:
|
||||
elasticsearch:
|
||||
cluster-nodes: 127.0.0.1:9300
|
||||
cluster-name: elasticsearch
|
||||
logging:
|
||||
level:
|
||||
root: info #日志配置DEBUG,INFO,WARN,ERROR
|
||||
com.macro.mall: debug
|
||||
11
mall-config/src/main/resources/config/search/search-prod.yml
Normal file
11
mall-config/src/main/resources/config/search/search-prod.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://db:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||
username: reader
|
||||
password: 123456
|
||||
data:
|
||||
elasticsearch:
|
||||
cluster-nodes: es:9300
|
||||
cluster-name: elasticsearch
|
||||
logging:
|
||||
path: /var/logs #配置日志生成路径
|
||||
Reference in New Issue
Block a user