Merge pull request 'sit' (#9) from sit into prod

Reviewed-on: http://wcy111.top:3000/xiaowang/JayuCloud/pulls/9
This commit was merged in pull request #9.
This commit is contained in:
2026-08-26 12:46:52 +08:00
2 changed files with 8 additions and 4 deletions
+5 -1
View File
@@ -17,7 +17,7 @@ for (const destination of target.destinations) {
}
async function publishDestination(destination, files) {
const nacosUrls = requiredEnvironment(`${destination.prefix}_URLS`).split(',').map((value) => value.trim()).filter(Boolean);
const nacosUrls = requiredEnvironment(`${destination.prefix}_URLS`).split(',').map((value) => normalizeNacosBaseUrl(value.trim())).filter(Boolean);
if (nacosUrls.length < destination.verificationNodeCount) {
throw new Error(`${destination.name} 至少需要 ${destination.verificationNodeCount} 个 Nacos 地址用于发布校验`);
}
@@ -46,6 +46,10 @@ function requiredEnvironment(name) {
return value;
}
function normalizeNacosBaseUrl(value) {
return value.replace(/\/+$/, '').replace(/\/nacos$/, '');
}
function requiredNacosTarget(name) {
const value = requiredEnvironment(name);
const destinations = {
@@ -31,13 +31,13 @@
| Secret | 内容要求 |
| --- | --- |
| `NACOS_PROD_URLS` | `http://192.168.10.11:8848/nacos,http://192.168.10.12:8848/nacos,http://192.168.10.13:8848/nacos` |
| `NACOS_PROD_URLS` | `http://192.168.10.11:8848/nacos,http://192.168.10.12:8848/nacos,http://192.168.10.13:8848/nacos`(也可省略末尾 `/nacos`) |
| `NACOS_PROD_USERNAME` | 生产 Nacos 发布专用账号,不能使用共享管理员账号 |
| `NACOS_PROD_PASSWORD` | 上述账号密码 |
| `NACOS_DR_URLS` | `http://192.168.20.10:8848/nacos` |
| `NACOS_DR_URLS` | `http://192.168.20.10:8848/nacos`(也可省略末尾 `/nacos`) |
| `NACOS_DR_USERNAME` | 中心2 Nacos 发布账号 |
| `NACOS_DR_PASSWORD` | 中心2 Nacos 发布账号密码 |
| `NACOS_SIT_URLS` | `http://192.168.10.103:8848/nacos` |
| `NACOS_SIT_URLS` | `http://192.168.10.103:8848/nacos`(也可省略末尾 `/nacos`) |
| `NACOS_SIT_USERNAME` | SIT Nacos 发布账号 |
| `NACOS_SIT_PASSWORD` | SIT Nacos 发布账号密码 |