From b2dea0c1b26f1e56b1cb389c261083087ed20a4b Mon Sep 17 00:00:00 2001 From: Roland Bewick Date: Mon, 15 Jan 2024 10:42:59 +0700 Subject: [PATCH] fix: local setup issues --- README.md | 4 ++++ package.json | 1 + scripts/start.js | 1 + src/daemon/index.ts | 1 + src/index.ts | 5 +++-- 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6455b67..0ab3170 100644 --- a/README.md +++ b/README.md @@ -52,8 +52,12 @@ git clone npm i npm run build npx prisma migrate deploy +npm start setup +npm start start ``` +_and then copy your connection string from the output to [nsecBunker UI](https://app.nsecbunker.com/). Your config is located at `./config/nsecbunker.json`_ + ## Configure ### Easy: Remote configuration diff --git a/package.json b/package.json index 5db87c1..1a7515c 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "prisma:migrate": "npx prisma migrate deploy", "prisma:create": "npx prisma db push --preview-feature", "start": "node ./scripts/start.js", + "setup": "node ./scripts/start.js setup", "lfg": "node ./scripts/start.js start", "nsecbunkerd": "node dist/index.js", "client": "node dist/client/client.js" diff --git a/scripts/start.js b/scripts/start.js index 271c1f2..22b07f0 100644 --- a/scripts/start.js +++ b/scripts/start.js @@ -14,5 +14,6 @@ const childProcess = spawn('node', ['./dist/index.js', ...args], { }); childProcess.on('exit', (code) => { + console.log("Exiting nsecbunkerd with code " + code) process.exit(code); }); diff --git a/src/daemon/index.ts b/src/daemon/index.ts index bcb2981..0679c35 100644 --- a/src/daemon/index.ts +++ b/src/daemon/index.ts @@ -1,3 +1,4 @@ +globalThis.crypto = require('crypto'); import "websocket-polyfill"; import run from './run'; import type {IConfig} from '../config/index'; diff --git a/src/index.ts b/src/index.ts index c8b3620..b8971f0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -9,7 +9,8 @@ import { start } from './commands/start.js'; const adminNpubs = process.env.ADMIN_NPUBS ? process.env.ADMIN_NPUBS.split(',') : []; -const argv = yargs(hideBin(process.argv)) + +yargs(hideBin(process.argv)) .command('setup', 'Setup nsecBunker', {}, (argv) => { setup(argv.config as string); }) @@ -65,5 +66,5 @@ const argv = yargs(hideBin(process.argv)) default: 'config/nsecbunker.json', }, }) - .demandCommand(0, 1) + .demandCommand(1, 1, "Please provide exactly one argument (e.g. setup, start, add)") .parse();