Skip to content

Commit

Permalink
refactor($Consul): use @ as profile separator
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
johnnymillergh committed Feb 27, 2022
1 parent c8305fb commit 209e079
Show file tree
Hide file tree
Showing 25 changed files with 126 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spring:
config:
# `default-context` should not be modified, keeps "application" for common configuration.
# Properties in the config/application folder are applicable to all applications using consul for configuration.
profile-separator: "::"
profile-separator: "@"
format: YAML
data-key: "data"
watch:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spring:
config:
# `default-context` should not be modified, keeps "application" for common configuration.
# Properties in the config/application folder are applicable to all applications using consul for configuration.
profile-separator: "::"
profile-separator: "@"
format: YAML
data-key: "data"
watch:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
greeting: "Hello, World! From Consul config center!"

maf:
configuration:
permission:
ignored-service-ids:
- "consul"
- "api-gateway"
- "spring-boot-admin"
- "auth-center"
excel:
maximum-row-count: 3000

logging:
level:
org.springframework.boot.context.config: TRACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
greeting: "Hello, World! From Consul config center!"

maf:
configuration:
permission:
ignored-service-ids:
- "consul"
- "api-gateway"
- "spring-boot-admin"
- "auth-center"
excel:
maximum-row-count: 3000

logging:
level:
org.springframework.boot.context.config: TRACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
greeting: "Hello, World! From Consul config center!"

maf:
configuration:
permission:
ignored-service-ids:
- "consul"
- "api-gateway"
- "spring-boot-admin"
- "auth-center"
excel:
maximum-row-count: 3000

logging:
level:
org.springframework.boot.context.config: TRACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
greeting: "Hello, World! From Consul config center!"

maf:
configuration:
permission:
ignored-service-ids:
- "consul"
- "api-gateway"
- "spring-boot-admin"
- "auth-center"
excel:
maximum-row-count: 3000

logging:
level:
org.springframework.boot.context.config: TRACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
spring:
shardingsphere:
props:
sql:
#设置sql是否展示
show: true
datasource:
#数据库名称(可以与数据库中的库名不一致)
names: ds0,ds1
ds0:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.169.50.200:3306/ds0?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT
username: root
password: ROOT
# 数据库连接池的最小连接数
min-idle: 5
# 初始化连接数
initial-size: 5
# 最大连接数
max-total: 5
max-wait-millis: 200s
ds1:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.169.50.201:3306/ds1?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT
username: root
password: ROOT
# 数据库连接池的最小连接数
min-idle: 5
# 初始化连接数
initial-size: 5
# 最大连接数
max-total: 5
max-wait-millis: 200s
sharding:
#分库策略
default-database-strategy:
inline:
#根据id取模决定去那个库
algorithm-expression: ds$->{id % 2}
sharding-column: id
tables:
#逻辑表名,这里的user_info为逻辑表名,user_info_0,user_info_1,user_info_2为实际表
user_info:
actual-data-nodes: ds$->{0..1}.user_info_$->{0..2}
table-strategy:
#根据id取模决定去那个表
inline:
sharding-column: id
algorithm-expression: user_info_$->{id % 3}
key-generator:
#id使用雪花算法
column: id
#雪花算法
type: SNOWFLAKE
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spring:
config:
# `default-context` should not be modified, keeps "application" for common configuration.
# Properties in the config/application folder are applicable to all applications using consul for configuration.
profile-separator: "::"
profile-separator: "@"
format: YAML
data-key: "data"
watch:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spring:
config:
# `default-context` should not be modified, keeps "application" for common configuration.
# Properties in the config/application folder are applicable to all applications using consul for configuration.
profile-separator: "::"
profile-separator: "@"
format: YAML
data-key: "data"
watch:
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<druid-spring-boot-starter.version>1.2.8</druid-spring-boot-starter.version>
<mybatis-plus-boot-starter.version>3.5.1</mybatis-plus-boot-starter.version>
<dynamic-datasource-spring-boot-starter.version>3.5.1</dynamic-datasource-spring-boot-starter.version>
<sharding-sphere.version>4.1.1</sharding-sphere.version>
<hutool-all.version>5.7.21</hutool-all.version>
<guava.version>31.0.1-jre</guava.version>
<springdoc-openapi-ui.version>1.6.6</springdoc-openapi-ui.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spring:
config:
# `default-context` should not be modified, keeps "application" for common configuration.
# Properties in the config/application folder are applicable to all applications using consul for configuration.
profile-separator: "::"
profile-separator: "@"
format: YAML
data-key: "data"
watch:
Expand Down

0 comments on commit 209e079

Please sign in to comment.