暂存提交
This commit is contained in:
+1
-1
@@ -18,7 +18,7 @@ public class WarehouseDatabaseGuardConfiguration {
|
||||
static BeanFactoryPostProcessor warehouseDatabaseGuard(Environment environment) {
|
||||
String url = environment.getProperty("spring.datasource.url", "").trim();
|
||||
Matcher matcher = MYSQL_SCHEMA.matcher(url);
|
||||
if (!matcher.matches() || !"baiyue_warehouse_overseas".equalsIgnoreCase(matcher.group(1))) {
|
||||
if (!matcher.matches() || !"baiyue_lastlag_warehouse".equalsIgnoreCase(matcher.group(1))) {
|
||||
throw new IllegalStateException(
|
||||
"warehouse-overseas-service requires spring.datasource.url to target the baiyue_warehouse_overseas database");
|
||||
}
|
||||
|
||||
@@ -29,9 +29,9 @@ spring:
|
||||
config.namespace: ${NACOS_NAMESPACE:public}
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: ${WAREHOUSE_DB_URL:jdbc:mysql://127.0.0.1:3306/baiyue_warehouse_overseas?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true}
|
||||
url: ${WAREHOUSE_DB_URL:jdbc:mysql://127.0.0.1:3306/baiyue_lastlag_warehouse?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true}
|
||||
username: ${WAREHOUSE_DB_USERNAME:root}
|
||||
password: ${WAREHOUSE_DB_PASSWORD:}
|
||||
password: ${WAREHOUSE_DB_PASSWORD:123456}
|
||||
management.endpoints.web.exposure.include: health,info,prometheus
|
||||
|
||||
baiyue:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
-- This script is run through warehouse-overseas-service's datasource only.
|
||||
-- The datasource guard requires the selected schema to be baiyue_warehouse_overseas;
|
||||
-- The datasource guard requires the selected schema to be baiyue_lastlag_warehouse;
|
||||
-- database creation and USE are intentionally forbidden here so a miswired
|
||||
-- service account cannot create or switch schemas during startup.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user