diff --git a/audit-service/src/main/resources/application-dev.yml b/audit-service/src/main/resources/application-dev.yml new file mode 100644 index 000000000..cd4d4a031 --- /dev/null +++ b/audit-service/src/main/resources/application-dev.yml @@ -0,0 +1,6 @@ +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: ${AUDIT_DB_URL:jdbc:mysql://127.0.0.1:3306/baiyue_audit?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true} + username: ${AUDIT_DB_USERNAME:root} + password: ${AUDIT_DB_PASSWORD:123456} diff --git a/audit-service/src/main/resources/application-test.yml b/audit-service/src/main/resources/application-test.yml new file mode 100644 index 000000000..5cde9b056 --- /dev/null +++ b/audit-service/src/main/resources/application-test.yml @@ -0,0 +1,6 @@ +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: ${AUDIT_TEST_DB_URL:jdbc:mysql://${TEST_DB_HOST:8.163.30.128}:${TEST_DB_PORT:3306}/baiyue_audit?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true&rewriteBatchedStatements=true} + username: ${AUDIT_TEST_DB_USERNAME:${TEST_DB_USERNAME:root}} + password: ${AUDIT_TEST_DB_PASSWORD:${TEST_DB_PASSWORD}} diff --git a/auth/src/main/resources/application-dev.yml b/auth/src/main/resources/application-dev.yml new file mode 100644 index 000000000..8174995ba --- /dev/null +++ b/auth/src/main/resources/application-dev.yml @@ -0,0 +1,6 @@ +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: ${AUTH_DB_URL:jdbc:mysql://127.0.0.1:3306/baiyue_auth?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true} + username: ${AUTH_DB_USERNAME:root} + password: ${AUTH_DB_PASSWORD:123456} diff --git a/auth/src/main/resources/application-test.yml b/auth/src/main/resources/application-test.yml new file mode 100644 index 000000000..718ce81ac --- /dev/null +++ b/auth/src/main/resources/application-test.yml @@ -0,0 +1,6 @@ +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: ${AUTH_TEST_DB_URL:jdbc:mysql://${TEST_DB_HOST:8.163.30.128}:${TEST_DB_PORT:3306}/baiyue_auth?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true&rewriteBatchedStatements=true} + username: ${AUTH_TEST_DB_USERNAME:${TEST_DB_USERNAME:root}} + password: ${AUTH_TEST_DB_PASSWORD:${TEST_DB_PASSWORD}} diff --git a/config/nacos/cn/integration-service.yml b/config/nacos/cn/integration-service.yml index a0de026fb..501252f3d 100644 --- a/config/nacos/cn/integration-service.yml +++ b/config/nacos/cn/integration-service.yml @@ -4,5 +4,14 @@ baiyue: enabled: ${BAIDU_OCR_ENABLED:false} api-key: ${BAIDU_OCR_API_KEY:} secret-key: ${BAIDU_OCR_SECRET_KEY:} + input-root: ${WEIGHT_OCR_INPUT_ROOT:/data/baiyue/weight-ocr/input} + output-root: ${WEIGHT_OCR_OUTPUT_ROOT:/data/baiyue/weight-ocr/output} + max-image-size: ${WEIGHT_OCR_MAX_IMAGE_SIZE:3MB} + max-image-pixels: ${WEIGHT_OCR_MAX_IMAGE_PIXELS:40000000} + max-batch-size: ${WEIGHT_OCR_MAX_BATCH_SIZE:50} + connect-timeout: ${BAIDU_OCR_CONNECT_TIMEOUT:10s} + request-timeout: ${BAIDU_OCR_REQUEST_TIMEOUT:60s} + min-request-interval: ${BAIDU_OCR_MIN_REQUEST_INTERVAL:600ms} + max-qps-retries: ${BAIDU_OCR_MAX_QPS_RETRIES:3} amazon-sp-api: enabled: ${AMAZON_SP_API_ENABLED:false} diff --git a/config/nacos/local/integration-service.yml b/config/nacos/local/integration-service.yml index f41753f73..445cdb281 100644 --- a/config/nacos/local/integration-service.yml +++ b/config/nacos/local/integration-service.yml @@ -1,3 +1,11 @@ -baiyue.integration: - baidu-ocr.enabled: ${BAIDU_OCR_ENABLED:false} - amazon-sp-api.enabled: ${AMAZON_SP_API_ENABLED:false} +baiyue: + integration: + baidu-ocr: + enabled: ${BAIDU_OCR_ENABLED:false} + input-root: ${WEIGHT_OCR_INPUT_ROOT:${java.io.tmpdir}/baiyue-weight-ocr/input} + output-root: ${WEIGHT_OCR_OUTPUT_ROOT:${java.io.tmpdir}/baiyue-weight-ocr/output} + max-image-size: ${WEIGHT_OCR_MAX_IMAGE_SIZE:3MB} + max-image-pixels: ${WEIGHT_OCR_MAX_IMAGE_PIXELS:40000000} + max-batch-size: ${WEIGHT_OCR_MAX_BATCH_SIZE:50} + amazon-sp-api: + enabled: ${AMAZON_SP_API_ENABLED:false} diff --git a/docs/数据库环境切换说明.md b/docs/数据库环境切换说明.md new file mode 100644 index 000000000..a147065b8 --- /dev/null +++ b/docs/数据库环境切换说明.md @@ -0,0 +1,67 @@ +# 数据库环境切换说明 + +## 环境定义 + +- `dev`:本地开发环境,连接 `127.0.0.1:3306`,默认账号为 `root/123456`。 +- `test`:联调测试环境,连接 `8.163.30.128:3306`,各微服务仍使用独立数据库。 + +所有服务默认使用 `dev`: + +```yaml +spring: + profiles: + active: ${SPRING_PROFILES_ACTIVE:dev} +``` + +建议不要直接修改配置文件。通过 IDEA 的启动配置设置 `Active profiles` 即可切换: + +- 本地数据库:`dev` +- 测试数据库:`test` + +也可以使用启动参数: + +```text +--spring.profiles.active=test +``` + +## 测试数据库密码 + +测试数据库密码不写入 Git。启动 `test` 环境前,在 IDEA 启动配置的环境变量中设置: + +```text +TEST_DB_PASSWORD=测试数据库密码 +``` + +公共测试连接参数支持覆盖: + +```text +TEST_DB_HOST=8.163.30.128 +TEST_DB_PORT=3306 +TEST_DB_USERNAME=root +TEST_DB_PASSWORD=测试数据库密码 +``` + +每个服务还支持使用自己的 `*_TEST_DB_URL`、`*_TEST_DB_USERNAME` 和 `*_TEST_DB_PASSWORD` 覆盖公共参数。 + +## 分库映射 + +| 服务 | 测试数据库 | +| --- | --- | +| 认证服务 | `baiyue_auth` | +| 权限服务 | `baiyue_iam` | +| 订单服务 | `baiyue_order` | +| 仓库服务 | `baiyue_warehouse` | +| 头程履约服务 | `baiyue_firstleg` | +| 文件服务 | `baiyue_file` | +| 打印服务 | `baiyue_print` | +| 审计服务 | `baiyue_audit` | +| 事件桥接服务 | `baiyue_event_bridge` | + +网关和集成服务没有业务数据库,但同样支持 `dev/test` Profile。网关在两种环境下都会自动加载 `cn` 路由配置。 + +## 注意事项 + +- `test` 只切换数据库,Nacos 和 Redis 默认仍连接本机。 +- 环境变量优先级高于配置文件,可用于临时覆盖单个服务。 +- 修改 IDEA 环境变量后需要重启对应服务。 +- 不要把测试数据库密码提交到配置文件、启动脚本或 Git。 diff --git a/event-bridge-service/src/main/resources/application-dev.yml b/event-bridge-service/src/main/resources/application-dev.yml new file mode 100644 index 000000000..19d0a9ad0 --- /dev/null +++ b/event-bridge-service/src/main/resources/application-dev.yml @@ -0,0 +1,6 @@ +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: ${EVENT_BRIDGE_DB_URL:jdbc:mysql://127.0.0.1:3306/baiyue_event_bridge?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true} + username: ${EVENT_BRIDGE_DB_USERNAME:root} + password: ${EVENT_BRIDGE_DB_PASSWORD:123456} diff --git a/event-bridge-service/src/main/resources/application-test.yml b/event-bridge-service/src/main/resources/application-test.yml new file mode 100644 index 000000000..6b8765c21 --- /dev/null +++ b/event-bridge-service/src/main/resources/application-test.yml @@ -0,0 +1,6 @@ +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: ${EVENT_BRIDGE_TEST_DB_URL:jdbc:mysql://${TEST_DB_HOST:8.163.30.128}:${TEST_DB_PORT:3306}/baiyue_event_bridge?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true&rewriteBatchedStatements=true} + username: ${EVENT_BRIDGE_TEST_DB_USERNAME:${TEST_DB_USERNAME:root}} + password: ${EVENT_BRIDGE_TEST_DB_PASSWORD:${TEST_DB_PASSWORD}} diff --git a/file/src/main/resources/application-dev.yml b/file/src/main/resources/application-dev.yml new file mode 100644 index 000000000..334396130 --- /dev/null +++ b/file/src/main/resources/application-dev.yml @@ -0,0 +1,6 @@ +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: ${FILE_DB_URL:jdbc:mysql://127.0.0.1:3306/baiyue_file?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true} + username: ${FILE_DB_USERNAME:root} + password: ${FILE_DB_PASSWORD:123456} diff --git a/file/src/main/resources/application-test.yml b/file/src/main/resources/application-test.yml new file mode 100644 index 000000000..fec0b48d0 --- /dev/null +++ b/file/src/main/resources/application-test.yml @@ -0,0 +1,6 @@ +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: ${FILE_TEST_DB_URL:jdbc:mysql://${TEST_DB_HOST:8.163.30.128}:${TEST_DB_PORT:3306}/baiyue_file?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true&rewriteBatchedStatements=true} + username: ${FILE_TEST_DB_USERNAME:${TEST_DB_USERNAME:root}} + password: ${FILE_TEST_DB_PASSWORD:${TEST_DB_PASSWORD}} diff --git a/firstleg/src/main/resources/application-dev.yml b/firstleg/src/main/resources/application-dev.yml new file mode 100644 index 000000000..5e849b5f8 --- /dev/null +++ b/firstleg/src/main/resources/application-dev.yml @@ -0,0 +1,6 @@ +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: ${FIRSTLEG_DB_URL:jdbc:mysql://127.0.0.1:3306/baiyue_firstleg?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true} + username: ${FIRSTLEG_DB_USERNAME:root} + password: ${FIRSTLEG_DB_PASSWORD:123456} diff --git a/firstleg/src/main/resources/application-test.yml b/firstleg/src/main/resources/application-test.yml new file mode 100644 index 000000000..f78a7a9b3 --- /dev/null +++ b/firstleg/src/main/resources/application-test.yml @@ -0,0 +1,6 @@ +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: ${FIRSTLEG_TEST_DB_URL:jdbc:mysql://${TEST_DB_HOST:8.163.30.128}:${TEST_DB_PORT:3306}/baiyue_firstleg?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true&rewriteBatchedStatements=true} + username: ${FIRSTLEG_TEST_DB_USERNAME:${TEST_DB_USERNAME:root}} + password: ${FIRSTLEG_TEST_DB_PASSWORD:${TEST_DB_PASSWORD}} diff --git a/iam/src/main/resources/application-dev.yml b/iam/src/main/resources/application-dev.yml new file mode 100644 index 000000000..de7343f90 --- /dev/null +++ b/iam/src/main/resources/application-dev.yml @@ -0,0 +1,6 @@ +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: ${IAM_DB_URL:jdbc:mysql://127.0.0.1:3306/baiyue_iam?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true} + username: ${IAM_DB_USERNAME:root} + password: ${IAM_DB_PASSWORD:123456} diff --git a/iam/src/main/resources/application-test.yml b/iam/src/main/resources/application-test.yml new file mode 100644 index 000000000..533e8c44c --- /dev/null +++ b/iam/src/main/resources/application-test.yml @@ -0,0 +1,6 @@ +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: ${IAM_TEST_DB_URL:jdbc:mysql://${TEST_DB_HOST:8.163.30.128}:${TEST_DB_PORT:3306}/baiyue_iam?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true&rewriteBatchedStatements=true} + username: ${IAM_TEST_DB_USERNAME:${TEST_DB_USERNAME:root}} + password: ${IAM_TEST_DB_PASSWORD:${TEST_DB_PASSWORD}} diff --git a/integration-service/pom.xml b/integration-service/pom.xml index b032012af..c167a47db 100644 --- a/integration-service/pom.xml +++ b/integration-service/pom.xml @@ -13,11 +13,21 @@ integration-service + + com.baiyue.shared + baiyue-common-core + ${project.version} + com.baiyue.shared baiyue-common-web ${project.version} + + com.baiyue.shared + baiyue-common-openapi + ${project.version} + com.alibaba.cloud spring-cloud-starter-alibaba-nacos-discovery diff --git a/integration-service/src/main/java/com/baiyue/integration/IntegrationServiceApplication.java b/integration-service/src/main/java/com/baiyue/integration/IntegrationServiceApplication.java index 670ad361c..fccecbc0b 100644 --- a/integration-service/src/main/java/com/baiyue/integration/IntegrationServiceApplication.java +++ b/integration-service/src/main/java/com/baiyue/integration/IntegrationServiceApplication.java @@ -4,7 +4,7 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.properties.ConfigurationPropertiesScan; -@SpringBootApplication +@SpringBootApplication(scanBasePackages = {"com.baiyue.integration", "com.baiyue.common.web"}) @ConfigurationPropertiesScan public class IntegrationServiceApplication { public static void main(String[] args) { diff --git a/integration-service/src/main/java/com/baiyue/integration/config/IntegrationProperties.java b/integration-service/src/main/java/com/baiyue/integration/config/IntegrationProperties.java index 09c4eec94..7ad1b09aa 100644 --- a/integration-service/src/main/java/com/baiyue/integration/config/IntegrationProperties.java +++ b/integration-service/src/main/java/com/baiyue/integration/config/IntegrationProperties.java @@ -1,12 +1,68 @@ package com.baiyue.integration.config; import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.util.unit.DataSize; + +import java.net.URI; +import java.nio.file.Path; +import java.time.Duration; @ConfigurationProperties(prefix = "baiyue.integration") public record IntegrationProperties(BaiduOcr baiduOcr, AmazonSpApi amazonSpApi) { - public record BaiduOcr(boolean enabled, String apiKey, String secretKey) { + public record BaiduOcr(boolean enabled, + String apiKey, + String secretKey, + URI tokenUrl, + URI meterUrl, + Duration connectTimeout, + Duration requestTimeout, + Path inputRoot, + Path outputRoot, + DataSize maxImageSize, + long maxImagePixels, + int maxBatchSize, + Duration minRequestInterval, + int maxQpsRetries) { public boolean configured() { - return enabled && hasText(apiKey) && hasText(secretKey); + return enabled + && hasText(apiKey) + && hasText(secretKey) + && tokenUrl != null + && meterUrl != null; + } + + public Duration effectiveConnectTimeout() { + return positive(connectTimeout) ? connectTimeout : Duration.ofSeconds(10); + } + + public Duration effectiveRequestTimeout() { + return positive(requestTimeout) ? requestTimeout : Duration.ofSeconds(60); + } + + public DataSize effectiveMaxImageSize() { + return maxImageSize != null && maxImageSize.toBytes() > 0 + ? maxImageSize : DataSize.ofMegabytes(3); + } + + public long effectiveMaxImagePixels() { + return maxImagePixels > 0 ? maxImagePixels : 40_000_000L; + } + + public int effectiveMaxBatchSize() { + return maxBatchSize > 0 ? maxBatchSize : 50; + } + + public Duration effectiveMinRequestInterval() { + return minRequestInterval != null && !minRequestInterval.isNegative() + ? minRequestInterval : Duration.ofMillis(600); + } + + public int effectiveMaxQpsRetries() { + return Math.min(10, Math.max(0, maxQpsRetries)); + } + + private boolean positive(Duration value) { + return value != null && !value.isNegative() && !value.isZero(); } } diff --git a/integration-service/src/main/java/com/baiyue/integration/security/InternalServiceTokenGuard.java b/integration-service/src/main/java/com/baiyue/integration/security/InternalServiceTokenGuard.java index dd0519417..e5d5932fc 100644 --- a/integration-service/src/main/java/com/baiyue/integration/security/InternalServiceTokenGuard.java +++ b/integration-service/src/main/java/com/baiyue/integration/security/InternalServiceTokenGuard.java @@ -1,9 +1,9 @@ package com.baiyue.integration.security; +import com.baiyue.common.core.api.ResultCode; +import com.baiyue.common.core.exception.BizException; import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.HttpStatus; import org.springframework.stereotype.Component; -import org.springframework.web.server.ResponseStatusException; import java.nio.charset.StandardCharsets; import java.security.MessageDigest; @@ -22,7 +22,7 @@ public class InternalServiceTokenGuard { public void verify(String actualToken) { byte[] actual = actualToken == null ? new byte[0] : actualToken.getBytes(StandardCharsets.UTF_8); if (!MessageDigest.isEqual(expectedToken, actual)) { - throw new ResponseStatusException(HttpStatus.UNAUTHORIZED, "内部服务令牌无效"); + throw new BizException(ResultCode.UNAUTHORIZED, "内部服务令牌无效"); } } } diff --git a/integration-service/src/main/resources/application.yml b/integration-service/src/main/resources/application.yml index 60cb6f509..d095bb084 100644 --- a/integration-service/src/main/resources/application.yml +++ b/integration-service/src/main/resources/application.yml @@ -35,6 +35,17 @@ baiyue: enabled: ${BAIDU_OCR_ENABLED:false} api-key: ${BAIDU_OCR_API_KEY:} secret-key: ${BAIDU_OCR_SECRET_KEY:} + token-url: ${BAIDU_OCR_TOKEN_URL:https://aip.baidubce.com/oauth/2.0/token} + meter-url: ${BAIDU_OCR_METER_URL:https://aip.baidubce.com/rest/2.0/ocr/v1/meter} + connect-timeout: ${BAIDU_OCR_CONNECT_TIMEOUT:10s} + request-timeout: ${BAIDU_OCR_REQUEST_TIMEOUT:60s} + input-root: ${WEIGHT_OCR_INPUT_ROOT:${java.io.tmpdir}/baiyue-weight-ocr/input} + output-root: ${WEIGHT_OCR_OUTPUT_ROOT:${java.io.tmpdir}/baiyue-weight-ocr/output} + max-image-size: ${WEIGHT_OCR_MAX_IMAGE_SIZE:3MB} + max-image-pixels: ${WEIGHT_OCR_MAX_IMAGE_PIXELS:40000000} + max-batch-size: ${WEIGHT_OCR_MAX_BATCH_SIZE:50} + min-request-interval: ${BAIDU_OCR_MIN_REQUEST_INTERVAL:600ms} + max-qps-retries: ${BAIDU_OCR_MAX_QPS_RETRIES:3} amazon-sp-api: enabled: ${AMAZON_SP_API_ENABLED:false} client-id: ${AMAZON_SP_API_CLIENT_ID:} diff --git a/integration-service/src/test/java/com/baiyue/integration/config/IntegrationPropertiesTest.java b/integration-service/src/test/java/com/baiyue/integration/config/IntegrationPropertiesTest.java index 2d23af5ee..489117122 100644 --- a/integration-service/src/test/java/com/baiyue/integration/config/IntegrationPropertiesTest.java +++ b/integration-service/src/test/java/com/baiyue/integration/config/IntegrationPropertiesTest.java @@ -2,19 +2,33 @@ package com.baiyue.integration.config; import org.junit.jupiter.api.Test; +import java.net.URI; +import java.nio.file.Path; +import java.time.Duration; + import static org.assertj.core.api.Assertions.assertThat; class IntegrationPropertiesTest { @Test void providerIsConfiguredOnlyWhenEnabledAndAllSecretsExist() { - var baidu = new IntegrationProperties.BaiduOcr(true, "key", "secret"); + var baidu = baidu(true, "key", "secret"); var amazon = new IntegrationProperties.AmazonSpApi( true, "client", "secret", "refresh", "access", "aws-secret", "us-east-1"); assertThat(baidu.configured()).isTrue(); assertThat(amazon.configured()).isTrue(); - assertThat(new IntegrationProperties.BaiduOcr(false, "key", "secret").configured()).isFalse(); + assertThat(baidu(false, "key", "secret").configured()).isFalse(); assertThat(new IntegrationProperties.AmazonSpApi( true, "client", "secret", "", "access", "aws-secret", "us-east-1").configured()).isFalse(); } + + private IntegrationProperties.BaiduOcr baidu(boolean enabled, String apiKey, String secretKey) { + return new IntegrationProperties.BaiduOcr( + enabled, apiKey, secretKey, + URI.create("https://example.com/token"), URI.create("https://example.com/meter"), + Duration.ofSeconds(10), Duration.ofSeconds(60), + Path.of("input"), Path.of("output"), null, + 40_000_000L, 50, Duration.ofMillis(600), 3 + ); + } } diff --git a/order/src/main/resources/application-dev.yml b/order/src/main/resources/application-dev.yml new file mode 100644 index 000000000..bef45e064 --- /dev/null +++ b/order/src/main/resources/application-dev.yml @@ -0,0 +1,6 @@ +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: ${ORDER_DB_URL:jdbc:mysql://127.0.0.1:3306/baiyue_order?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true} + username: ${ORDER_DB_USERNAME:root} + password: ${ORDER_DB_PASSWORD:123456} diff --git a/order/src/main/resources/application-test.yml b/order/src/main/resources/application-test.yml new file mode 100644 index 000000000..b6652c04d --- /dev/null +++ b/order/src/main/resources/application-test.yml @@ -0,0 +1,6 @@ +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: ${ORDER_TEST_DB_URL:jdbc:mysql://${TEST_DB_HOST:8.163.30.128}:${TEST_DB_PORT:3306}/baiyue_order?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true&rewriteBatchedStatements=true} + username: ${ORDER_TEST_DB_USERNAME:${TEST_DB_USERNAME:root}} + password: ${ORDER_TEST_DB_PASSWORD:${TEST_DB_PASSWORD}} diff --git a/print/src/main/resources/application-dev.yml b/print/src/main/resources/application-dev.yml new file mode 100644 index 000000000..09ebd1359 --- /dev/null +++ b/print/src/main/resources/application-dev.yml @@ -0,0 +1,6 @@ +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: ${PRINT_DB_URL:jdbc:mysql://127.0.0.1:3306/baiyue_print?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true} + username: ${PRINT_DB_USERNAME:root} + password: ${PRINT_DB_PASSWORD:123456} diff --git a/print/src/main/resources/application-test.yml b/print/src/main/resources/application-test.yml new file mode 100644 index 000000000..028726cdc --- /dev/null +++ b/print/src/main/resources/application-test.yml @@ -0,0 +1,6 @@ +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: ${PRINT_TEST_DB_URL:jdbc:mysql://${TEST_DB_HOST:8.163.30.128}:${TEST_DB_PORT:3306}/baiyue_print?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true&rewriteBatchedStatements=true} + username: ${PRINT_TEST_DB_USERNAME:${TEST_DB_USERNAME:root}} + password: ${PRINT_TEST_DB_PASSWORD:${TEST_DB_PASSWORD}} diff --git a/warehouse/src/main/resources/application-dev.yml b/warehouse/src/main/resources/application-dev.yml new file mode 100644 index 000000000..73de396cf --- /dev/null +++ b/warehouse/src/main/resources/application-dev.yml @@ -0,0 +1,6 @@ +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: ${WAREHOUSE_DB_URL:jdbc:mysql://127.0.0.1:3306/baiyue_warehouse?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true} + username: ${WAREHOUSE_DB_USERNAME:root} + password: ${WAREHOUSE_DB_PASSWORD:123456} diff --git a/warehouse/src/main/resources/application-test.yml b/warehouse/src/main/resources/application-test.yml new file mode 100644 index 000000000..3b61d1dbb --- /dev/null +++ b/warehouse/src/main/resources/application-test.yml @@ -0,0 +1,6 @@ +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: ${WAREHOUSE_TEST_DB_URL:jdbc:mysql://${TEST_DB_HOST:8.163.30.128}:${TEST_DB_PORT:3306}/baiyue_warehouse?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true&rewriteBatchedStatements=true} + username: ${WAREHOUSE_TEST_DB_USERNAME:${TEST_DB_USERNAME:root}} + password: ${WAREHOUSE_TEST_DB_PASSWORD:${TEST_DB_PASSWORD}}