mirror of
https://github.com/logos-storage/logos-storage-installer.git
synced 2026-01-07 07:53:08 +00:00
debugs config.toml formatting
This commit is contained in:
parent
0f69d61e8e
commit
65e38a8bab
@ -29,37 +29,36 @@ export class ProcessControl {
|
||||
|
||||
console.log("start a codex detached");
|
||||
|
||||
console.log("nat: " + (await this.getPublicIp()));
|
||||
console.log("logs dir: " + this.getLogFile());
|
||||
console.log("data dir: " + this.config.dataDir);
|
||||
console.log("api port: " + this.config.ports.apiPort);
|
||||
console.log("codex exe: " + this.config.codexExe);
|
||||
console.log("quota: " + this.config.storageQuota);
|
||||
|
||||
const executable = this.config.codexExe;
|
||||
const args = [
|
||||
`--data-dir=${this.config.dataDir}`,
|
||||
// `--log-level=DEBUG`,
|
||||
// `--log-file="${this.getLogFile()}"`,
|
||||
`--storage-quota=${this.config.storageQuota}`,
|
||||
`--disc-port=${this.config.ports.discPort}`,
|
||||
`--listen-addrs=/ip4/0.0.0.0/tcp/${this.config.ports.listenPort}`,
|
||||
`--api-port=${this.config.ports.apiPort}`,
|
||||
`--nat=extip:${await this.getPublicIp()}`,
|
||||
`--api-cors-origin="*"`,
|
||||
`--bootstrap-node=spr:CiUIAhIhAiJvIcA_ZwPZ9ugVKDbmqwhJZaig5zKyLiuaicRcCGqLEgIDARo8CicAJQgCEiECIm8hwD9nA9n26BUoNuarCEllqKDnMrIuK5qJxFwIaosQ3d6esAYaCwoJBJ_f8zKRAnU6KkYwRAIgM0MvWNJL296kJ9gWvfatfmVvT-A7O2s8Mxp8l9c8EW0CIC-h-H-jBVSgFjg3Eny2u33qF7BDnWFzo7fGfZ7_qc9P`,
|
||||
const args = [`--config-file=${this.config.codexConfigFilePath}`];
|
||||
const bootstrapNodes = [
|
||||
"spr:CiUIAhIhAiJvIcA_ZwPZ9ugVKDbmqwhJZaig5zKyLiuaicRcCGqLEgIDARo8CicAJQgCEiECIm8hwD9nA9n26BUoNuarCEllqKDnMrIuK5qJxFwIaosQ3d6esAYaCwoJBJ_f8zKRAnU6KkYwRAIgM0MvWNJL296kJ9gWvfatfmVvT-A7O2s8Mxp8l9c8EW0CIC-h-H-jBVSgFjg3Eny2u33qF7BDnWFzo7fGfZ7_qc9P",
|
||||
];
|
||||
const publicIp = await this.getPublicIp();
|
||||
|
||||
this.configService.writeCodexConfigFile(publicIp, bootstrapNodes);
|
||||
|
||||
const command = `"${executable}" ${args.join(" ")}`;
|
||||
console.log("command: " + command);
|
||||
console.log("\n\n");
|
||||
|
||||
this.configService.writeCodexConfigFile();
|
||||
|
||||
var child = spawn(executable, args, {
|
||||
detached: true,
|
||||
stdio: ["ignore", "ignore", "ignore"],
|
||||
//stdio: ["ignore", "ignore", "ignore"],
|
||||
});
|
||||
|
||||
child.stdout.on("data", (data) => {
|
||||
console.log(`stdout: ${data}`);
|
||||
});
|
||||
|
||||
child.stderr.on("data", (data) => {
|
||||
console.error(`stderr: ${data}`);
|
||||
});
|
||||
|
||||
child.on("close", (code) => {
|
||||
console.log(`child process exited with code ${code}`);
|
||||
});
|
||||
|
||||
child.unref();
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, 2000));
|
||||
|
||||
@ -79,18 +79,18 @@ export class ConfigService {
|
||||
|
||||
writeCodexConfigFile = (publicIp, bootstrapNodes) => {
|
||||
const nl = "\n";
|
||||
const bootNodes = bootstrapNodes.join(",");
|
||||
const bootNodes = bootstrapNodes.map((v) => `"${v}"`).join(",");
|
||||
|
||||
this.fs.writeFile(
|
||||
this.config.codexConfigFilePath,
|
||||
`data-dir="${this.format(this.config.dataDir)}"${nl}` +
|
||||
`log-level=DEBUG${nl}` +
|
||||
`log-level="DEBUG"${nl}` +
|
||||
`log-file="${this.format(this.getLogFilePath())}"${nl}` +
|
||||
`storage-quota=${this.config.storageQuota}${nl}` +
|
||||
`disc-port=${this.config.ports.discPort}${nl}` +
|
||||
`listen-addrs=/ip4/0.0.0.0/tcp/${this.config.ports.listenPort}${nl}` +
|
||||
`listen-addrs=["/ip4/0.0.0.0/tcp/${this.config.ports.listenPort}"]${nl}` +
|
||||
`api-port=${this.config.ports.apiPort}${nl}` +
|
||||
`nat=extip:${publicIp}${nl}` +
|
||||
`nat="extip:${publicIp}"${nl}` +
|
||||
`api-cors-origin="*"${nl}` +
|
||||
`bootstrap-node=[${bootNodes}]`,
|
||||
);
|
||||
|
||||
@ -114,15 +114,19 @@ describe("ConfigService", () => {
|
||||
expect(mockFsService.writeFile).toHaveBeenCalledWith(
|
||||
expectedDefaultConfig.codexConfigFilePath,
|
||||
`data-dir=\"${formatPath(expectedDefaultConfig.dataDir)}"${newLine}` +
|
||||
`log-level=DEBUG${newLine}` +
|
||||
`log-level="DEBUG"${newLine}` +
|
||||
`log-file="${formatPath(logsPath)}"${newLine}` +
|
||||
`storage-quota=${expectedDefaultConfig.storageQuota}${newLine}` +
|
||||
`disc-port=${expectedDefaultConfig.ports.discPort}${newLine}` +
|
||||
`listen-addrs=/ip4/0.0.0.0/tcp/${expectedDefaultConfig.ports.listenPort}${newLine}` +
|
||||
`listen-addrs=["/ip4/0.0.0.0/tcp/${expectedDefaultConfig.ports.listenPort}"]${newLine}` +
|
||||
`api-port=${expectedDefaultConfig.ports.apiPort}${newLine}` +
|
||||
`nat=extip:${publicIp}${newLine}` +
|
||||
`nat="extip:${publicIp}"${newLine}` +
|
||||
`api-cors-origin="*"${newLine}` +
|
||||
`bootstrap-node=[${bootstrapNodes.join(",")}]`,
|
||||
`bootstrap-node=[${bootstrapNodes
|
||||
.map((v) => {
|
||||
return '"' + v + '"';
|
||||
})
|
||||
.join(",")}]`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user