forked from mtusi2026/mtusi2026lab7
32 lines
781 B
TypeScript
32 lines
781 B
TypeScript
import { run, requireThat, safeFailure } from "./runtime";
|
|
import { images } from "./topology";
|
|
try {
|
|
const source = await run([
|
|
"docker",
|
|
"run",
|
|
"--pull=never",
|
|
"--rm",
|
|
"--entrypoint",
|
|
"sh",
|
|
images.s3,
|
|
"-c",
|
|
"command -v rustfs; rustfs --help",
|
|
]);
|
|
const combined = source.out + source.err;
|
|
console.log(
|
|
JSON.stringify({
|
|
service: "RustFS",
|
|
binary: source.out.split("\n")[0],
|
|
address_flag: combined.includes("--address"),
|
|
console_enable_flag: combined.includes("--console-enable"),
|
|
environment_names: [
|
|
...new Set(combined.match(/\bRUSTFS_[A-Z_]+\b/g) ?? []),
|
|
],
|
|
stdout_length: source.out.length,
|
|
stderr_length: source.err.length,
|
|
}),
|
|
);
|
|
} catch (e) {
|
|
safeFailure(e);
|
|
}
|