forked from wangziqi/gongxue-base
test: warn on PNVS template placeholder drift
This commit is contained in:
@@ -204,6 +204,12 @@ function missingPublicKeyGroups(configPublic, groups) {
|
||||
.map(group => group.label);
|
||||
}
|
||||
|
||||
function pnvsTemplateParamHasCodePlaceholder(configPublic) {
|
||||
const value = configPublic?.templateParam;
|
||||
if (!value || typeof value !== 'object' || Array.isArray(value)) return true;
|
||||
return Object.values(value).some(item => String(item) === '##code##');
|
||||
}
|
||||
|
||||
function blockMissingPublicConfig(row, missing) {
|
||||
if (missing.length === 0) return;
|
||||
block(
|
||||
@@ -258,6 +264,13 @@ function validateAuthProviderPublicConfig(row) {
|
||||
if (!publicString(configPublic, ['regionId'])) {
|
||||
warn(`db.auth.${safeProviderName(row.provider)}.region`, 'Aliyun PNVS regionId is not set; default cn-hangzhou will be used', details);
|
||||
}
|
||||
if (!pnvsTemplateParamHasCodePlaceholder(configPublic)) {
|
||||
warn(
|
||||
`db.auth.${safeProviderName(row.provider)}.template_param`,
|
||||
'Aliyun PNVS templateParam should include ##code##; backend will add code placeholder automatically',
|
||||
details,
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user