统一 Rust 与 TypeScript 格式化门禁
纳入 AGC Cargo workspace 的统一 rustfmt 检查与格式化入口 完成项目 TypeScript/Prettier 与 Rust 全量格式化 修复 Pingora expected executable 门禁的空白敏感误报 同步开发运维文档与 AGC skill pack 格式化忽略规则
This commit is contained in:
@@ -70,12 +70,9 @@ function parseArgs(argv) {
|
||||
process.env.GENARRATIVE_HEALTH_PATROL_ENV_FILE ||
|
||||
'/etc/genarrative/health-patrol.env',
|
||||
gatewayMode: process.env.GENARRATIVE_HEALTH_PATROL_GATEWAY_MODE || '',
|
||||
publicBaseUrl:
|
||||
process.env.GENARRATIVE_HEALTH_PATROL_PUBLIC_BASE_URL || '',
|
||||
publicBaseUrl: process.env.GENARRATIVE_HEALTH_PATROL_PUBLIC_BASE_URL || '',
|
||||
publicHost: process.env.GENARRATIVE_HEALTH_PATROL_PUBLIC_HOST || null,
|
||||
clearPublicHost: readBoolEnv(
|
||||
'GENARRATIVE_HEALTH_PATROL_CLEAR_PUBLIC_HOST',
|
||||
),
|
||||
clearPublicHost: readBoolEnv('GENARRATIVE_HEALTH_PATROL_CLEAR_PUBLIC_HOST'),
|
||||
checkScript:
|
||||
process.env.GENARRATIVE_HEALTH_PATROL_ENV_CHECK_SCRIPT ||
|
||||
defaultEnvCheckScript(),
|
||||
@@ -196,7 +193,10 @@ function readBoolEnv(name) {
|
||||
function defaultEnvCheckScript() {
|
||||
const scriptPath = fileURLToPath(import.meta.url);
|
||||
const releaseRoot = path.resolve(path.dirname(scriptPath), '../..');
|
||||
return path.join(releaseRoot, 'scripts/check-production-health-patrol-env.mjs');
|
||||
return path.join(
|
||||
releaseRoot,
|
||||
'scripts/check-production-health-patrol-env.mjs',
|
||||
);
|
||||
}
|
||||
|
||||
function requireValue(argv, index, flag) {
|
||||
|
||||
@@ -136,10 +136,7 @@ function parseArgs(argv) {
|
||||
}
|
||||
}
|
||||
|
||||
validateSafeAbsoluteFilePath(
|
||||
result.sourceCertFile,
|
||||
'--source-cert-file',
|
||||
);
|
||||
validateSafeAbsoluteFilePath(result.sourceCertFile, '--source-cert-file');
|
||||
validateSafeAbsoluteFilePath(result.sourceKeyFile, '--source-key-file');
|
||||
validateSafeAbsoluteDirectoryPath(result.targetDir, '--target-dir');
|
||||
validateIdentity(result.serviceUser, '--service-user');
|
||||
@@ -231,7 +228,10 @@ function run() {
|
||||
config.sourceCertFile,
|
||||
'--source-cert-file',
|
||||
);
|
||||
const keySource = inspectSourceFile(config.sourceKeyFile, '--source-key-file');
|
||||
const keySource = inspectSourceFile(
|
||||
config.sourceKeyFile,
|
||||
'--source-key-file',
|
||||
);
|
||||
const certTarget = path.join(config.targetDir, 'fullchain.pem');
|
||||
const keyTarget = path.join(config.targetDir, 'privkey.pem');
|
||||
const owner = config.apply
|
||||
@@ -284,10 +284,10 @@ function run() {
|
||||
copyAtomic(certSource.resolvedPath, certTarget, owner);
|
||||
copyAtomic(keySource.resolvedPath, keyTarget, owner);
|
||||
|
||||
planned.serviceUserReadable = assertServiceUserReadable(
|
||||
config.serviceUser,
|
||||
[certTarget, keyTarget],
|
||||
);
|
||||
planned.serviceUserReadable = assertServiceUserReadable(config.serviceUser, [
|
||||
certTarget,
|
||||
keyTarget,
|
||||
]);
|
||||
return planned;
|
||||
}
|
||||
|
||||
@@ -423,7 +423,11 @@ function isCurrentUserRoot() {
|
||||
|
||||
function applyOwner(filePath, owner) {
|
||||
const current = currentIdentity();
|
||||
if (!isCurrentUserRoot() && owner.uid === current.uid && owner.gid === current.gid) {
|
||||
if (
|
||||
!isCurrentUserRoot() &&
|
||||
owner.uid === current.uid &&
|
||||
owner.gid === current.gid
|
||||
) {
|
||||
return;
|
||||
}
|
||||
chownSync(filePath, owner.uid, owner.gid);
|
||||
@@ -462,9 +466,13 @@ function assertServiceUserReadable(serviceUser, files) {
|
||||
return true;
|
||||
}
|
||||
for (const file of files) {
|
||||
const check = spawnSync('sudo', ['-n', '-u', serviceUser, 'test', '-r', file], {
|
||||
encoding: 'utf8',
|
||||
});
|
||||
const check = spawnSync(
|
||||
'sudo',
|
||||
['-n', '-u', serviceUser, 'test', '-r', file],
|
||||
{
|
||||
encoding: 'utf8',
|
||||
},
|
||||
);
|
||||
if (check.status !== 0) {
|
||||
const detail = (check.stderr || check.stdout || '').trim();
|
||||
throw new Error(
|
||||
|
||||
@@ -8,7 +8,8 @@ import {
|
||||
validateSpacetimeDatabaseName,
|
||||
} from '../spacetime-migration-common.mjs';
|
||||
|
||||
const PROCEDURE = 'rotate_editor_generation_runtime_service_identity_and_return';
|
||||
const PROCEDURE =
|
||||
'rotate_editor_generation_runtime_service_identity_and_return';
|
||||
|
||||
function usage() {
|
||||
console.error(
|
||||
@@ -50,7 +51,9 @@ async function readCurrentCliIdentity() {
|
||||
if (signal) {
|
||||
reject(new Error(`spacetime login show 被信号中断: ${signal}`));
|
||||
} else if (code !== 0) {
|
||||
reject(new Error(`无法读取当前 SpacetimeDB CLI identity,退出码 ${code}`));
|
||||
reject(
|
||||
new Error(`无法读取当前 SpacetimeDB CLI identity,退出码 ${code}`),
|
||||
);
|
||||
} else {
|
||||
resolve(text);
|
||||
}
|
||||
@@ -110,10 +113,15 @@ try {
|
||||
const options = parseOptions(process.argv.slice(2));
|
||||
validateSpacetimeDatabaseName(options.database);
|
||||
if (!/^https?:\/\/[A-Za-z0-9.-]+(?::[0-9]{1,5})?$/u.test(options.serverUrl)) {
|
||||
throw new Error('--server-url 必须是无路径、无查询参数的显式 http(s) URL。');
|
||||
throw new Error(
|
||||
'--server-url 必须是无路径、无查询参数的显式 http(s) URL。',
|
||||
);
|
||||
}
|
||||
|
||||
const operatorIdentity = normalizeIdentity(options.operatorIdentity, '--operator-identity');
|
||||
const operatorIdentity = normalizeIdentity(
|
||||
options.operatorIdentity,
|
||||
'--operator-identity',
|
||||
);
|
||||
const nextWriterIdentity = normalizeIdentity(
|
||||
options.nextWriterIdentity,
|
||||
'--next-writer-identity',
|
||||
@@ -123,15 +131,21 @@ try {
|
||||
'--confirm-next-writer-identity',
|
||||
);
|
||||
if (nextWriterIdentity !== confirmedIdentity) {
|
||||
throw new Error('--confirm-next-writer-identity 必须与 --next-writer-identity 完全一致。');
|
||||
throw new Error(
|
||||
'--confirm-next-writer-identity 必须与 --next-writer-identity 完全一致。',
|
||||
);
|
||||
}
|
||||
if (nextWriterIdentity === operatorIdentity) {
|
||||
throw new Error('runtime writer identity 不能设为 migration operator identity。');
|
||||
throw new Error(
|
||||
'runtime writer identity 不能设为 migration operator identity。',
|
||||
);
|
||||
}
|
||||
|
||||
const currentCliIdentity = await readCurrentCliIdentity();
|
||||
if (operatorIdentity !== currentCliIdentity) {
|
||||
throw new Error('--operator-identity 必须与当前 SpacetimeDB CLI 登录 identity 一致。');
|
||||
throw new Error(
|
||||
'--operator-identity 必须与当前 SpacetimeDB CLI 登录 identity 一致。',
|
||||
);
|
||||
}
|
||||
|
||||
const operatorUserId = options.operatorUserId.trim();
|
||||
@@ -144,7 +158,11 @@ try {
|
||||
}
|
||||
|
||||
const result = await callSpacetimeProcedureViaCli(
|
||||
{ database: options.database, serverUrl: options.serverUrl, passthrough: [] },
|
||||
{
|
||||
database: options.database,
|
||||
serverUrl: options.serverUrl,
|
||||
passthrough: [],
|
||||
},
|
||||
PROCEDURE,
|
||||
{
|
||||
next_writer_identity_hex: nextWriterIdentity,
|
||||
|
||||
Reference in New Issue
Block a user