fix: patch log4j config file to prevent logging in xml
This commit is contained in:
parent
6193863abc
commit
2e944d8a85
1 changed files with 13 additions and 6 deletions
|
|
@ -5,6 +5,11 @@ import { exists } from "../utils/fs";
|
|||
import { hash } from "crypto";
|
||||
import fs from "fs/promises";
|
||||
|
||||
async function patchFileLog4j(versionManifest: Version, xmlDestination: string) {
|
||||
const original = await fs.readFile(xmlDestination, {encoding: "utf-8"})
|
||||
await fs.writeFile(xmlDestination, original.replace("<LegacyXMLLayout />", ""))
|
||||
}
|
||||
|
||||
export async function getArgument(
|
||||
versionManifest: Version,
|
||||
destination: string,
|
||||
|
|
@ -18,13 +23,15 @@ export async function getArgument(
|
|||
url: versionManifest.logging.client.file.url,
|
||||
path: xmlDestination,
|
||||
});
|
||||
}
|
||||
|
||||
if (
|
||||
hash("sha1", await fs.readFile(xmlDestination, { encoding: "utf-8" })) !==
|
||||
versionManifest.logging.client.file.sha1
|
||||
) {
|
||||
throw new Error("Wrong hash for log4j's xml config");
|
||||
if (
|
||||
hash("sha1", await fs.readFile(xmlDestination, { encoding: "utf-8" })) !==
|
||||
versionManifest.logging.client.file.sha1
|
||||
) {
|
||||
throw new Error("Wrong hash for log4j's xml config");
|
||||
}
|
||||
|
||||
await patchFileLog4j(versionManifest, xmlDestination)
|
||||
}
|
||||
|
||||
return versionManifest.logging.client.argument.replace(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue