mirror of
https://github.com/logos-storage/logos-storage-installer.git
synced 2026-01-08 00:13:07 +00:00
working example of marketplace client install and start on win
This commit is contained in:
parent
d017b5a733
commit
77a5da5be8
@ -77,8 +77,8 @@ export class ProcessControl {
|
|||||||
// Open issue: https://github.com/codex-storage/nim-codex/issues/1206
|
// Open issue: https://github.com/codex-storage/nim-codex/issues/1206
|
||||||
// So we're setting them here.
|
// So we're setting them here.
|
||||||
"persistence",
|
"persistence",
|
||||||
`--eth-provider=https://rpc.testnet.codex.storage`,
|
`--eth-provider=${this.codexGlobals.getEthProvider()}`,
|
||||||
`--eth-private-key=eth.key`
|
`--eth-private-key=eth.key`, // duplicated in configService.
|
||||||
];
|
];
|
||||||
await this.shell.spawnDetachedProcess(executable, workingDir, args);
|
await this.shell.spawnDetachedProcess(executable, workingDir, args);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -109,7 +109,12 @@ export async function main() {
|
|||||||
const configService = new ConfigService(fsService, osService);
|
const configService = new ConfigService(fsService, osService);
|
||||||
const codexApp = new CodexApp(configService);
|
const codexApp = new CodexApp(configService);
|
||||||
const pathSelector = new PathSelector(uiService, new MenuLoop(), fsService);
|
const pathSelector = new PathSelector(uiService, new MenuLoop(), fsService);
|
||||||
const ethersService = new EthersService(fsService, configService);
|
const ethersService = new EthersService(
|
||||||
|
fsService,
|
||||||
|
configService,
|
||||||
|
osService,
|
||||||
|
shellService,
|
||||||
|
);
|
||||||
const marketplaceSetup = new MarketplaceSetup(
|
const marketplaceSetup = new MarketplaceSetup(
|
||||||
uiService,
|
uiService,
|
||||||
configService,
|
configService,
|
||||||
|
|||||||
@ -13,5 +13,5 @@ export class CodexGlobals {
|
|||||||
|
|
||||||
getEthProvider = () => {
|
getEthProvider = () => {
|
||||||
return "https://rpc.testnet.codex.storage";
|
return "https://rpc.testnet.codex.storage";
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -94,22 +94,18 @@ export class ConfigService {
|
|||||||
this.fs.writeFile(
|
this.fs.writeFile(
|
||||||
this.getCodexConfigFilePath(),
|
this.getCodexConfigFilePath(),
|
||||||
`data-dir="${datadir}"${nl}` +
|
`data-dir="${datadir}"${nl}` +
|
||||||
`log-level="TRACE"${nl}` +
|
`log-level="TRACE"${nl}` +
|
||||||
`log-file="${codexLogFile}"${nl}` +
|
`log-file="${codexLogFile}"${nl}` +
|
||||||
`storage-quota=${this.config.storageQuota}${nl}` +
|
`storage-quota=${this.config.storageQuota}${nl}` +
|
||||||
`disc-port=${this.config.ports.discPort}${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}` +
|
`api-port=${this.config.ports.apiPort}${nl}` +
|
||||||
`nat="extip:${publicIp}"${nl}` +
|
`nat="extip:${publicIp}"${nl}` +
|
||||||
`api-cors-origin="*"${nl}` +
|
`api-cors-origin="*"${nl}` +
|
||||||
`bootstrap-node=[${bootNodes}]${nl}` +
|
`bootstrap-node=[${bootNodes}]${nl}` +
|
||||||
// Marketplace client parameters:
|
// Marketplace client parameters cannot be set via config file.
|
||||||
// `[persistence]${nl}` +
|
// Open issue: https://github.com/codex-storage/nim-codex/issues/1206
|
||||||
//`eth-provider="${ethProvider}"${nl}` +
|
`${nl}`,
|
||||||
// `eth-provider="https://rpc.testnet.codex.storage"${nl}` +
|
|
||||||
// //`eth-private-key="${ethKeyFile}"${nl}` +
|
|
||||||
// `eth-private-key="notafile.no"${nl}` +
|
|
||||||
`${nl}`
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
import { ethers } from 'ethers';
|
import { ethers } from "ethers";
|
||||||
import crypto from "crypto";
|
import crypto from "crypto";
|
||||||
|
|
||||||
export class EthersService {
|
export class EthersService {
|
||||||
constructor(fsService, configService) {
|
constructor(fsService, configService, osService, shellService) {
|
||||||
this.fs = fsService;
|
this.fs = fsService;
|
||||||
this.configService = configService;
|
this.configService = configService;
|
||||||
|
this.os = osService;
|
||||||
|
this.shell = shellService;
|
||||||
}
|
}
|
||||||
|
|
||||||
getOrCreateEthKey = () => {
|
getOrCreateEthKey = () => {
|
||||||
@ -27,6 +29,14 @@ export class EthersService {
|
|||||||
const keys = this.generateKey();
|
const keys = this.generateKey();
|
||||||
this.fs.writeFile(paths.key, keys.key);
|
this.fs.writeFile(paths.key, keys.key);
|
||||||
this.fs.writeFile(paths.address, keys.address);
|
this.fs.writeFile(paths.address, keys.address);
|
||||||
|
|
||||||
|
if (this.os.isWindows()) {
|
||||||
|
const username = this.os.getUsername();
|
||||||
|
this.shell.run(`icacls ${paths.key} /inheritance:r >nul 2>&1`);
|
||||||
|
this.shell.run(`icacls ${paths.key} /grant:r ${username}:F >nul 2>&1`);
|
||||||
|
} else {
|
||||||
|
this.shell.run(`chmod 600 "${paths.key}"`);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
generateKey = () => {
|
generateKey = () => {
|
||||||
|
|||||||
@ -33,4 +33,8 @@ export class OsService {
|
|||||||
terminateProcess = (pid) => {
|
terminateProcess = (pid) => {
|
||||||
process.kill(pid, "SIGTERM");
|
process.kill(pid, "SIGTERM");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
getUsername = () => {
|
||||||
|
return os.userInfo().username;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user