tencentcloud-edgeone-migration-nodejs-v2
Version:
tencentcloud cdn config copy to edgeone
43 lines (38 loc) • 1.03 kB
JavaScript
const { t } = require("../../i18n/trans");
const genLog = require("../../logGenerator");
function ForceRedirect(domain, domainConfig, ruleTransferLog) {
const keyConfig = domainConfig.ForceRedirect;
if (!keyConfig || keyConfig.Switch !== 'on') {
ruleTransferLog.push({
config: t('强制跳转(ForceRedirect)'),
result: t('未配置'),
detail: ''
});
genLog.defaultLog(`${t('强制跳转(ForceRedirect)')}${t('未配置')}`)
return null;
}
ruleTransferLog.push({
config: t('强制跳转(ForceRedirect)'),
result: t('成功'),
detail: ''
});
genLog.successLog(`${t('强制跳转(ForceRedirect)')}${t('成功')}`)
return {
'NormalAction': {
'Action': 'ForceRedirect',
'Parameters': [
{
'Name': 'Switch',
'Values': [
'on'
]
},
{
'Name': 'RedirectStatusCode',
'Values': [String(keyConfig.RedirectStatusCode)]
}
]
}
};
}
module.exports = ForceRedirect;