write to a file the connection string
This commit is contained in:
parent
6775855e0c
commit
f949c116db
9 changed files with 512 additions and 918 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -4,4 +4,4 @@ dist
|
|||
**/*.d.ts
|
||||
**/*.d.ts.map
|
||||
nsecbunker.json
|
||||
prisma/nsecbunker.db*
|
||||
connection.txt
|
||||
|
|
|
|||
11
Dockerfile
11
Dockerfile
|
|
@ -1,12 +1,15 @@
|
|||
FROM --platform=linux/amd64 node:slim as build
|
||||
FROM --platform=linux/amd64 node:19 as build
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json .
|
||||
COPY package.json package-lock.json .
|
||||
RUN npm i
|
||||
|
||||
COPY . .
|
||||
COPY src/ src/
|
||||
COPY prisma/ prisma/
|
||||
COPY tsconfig.json .
|
||||
|
||||
RUN npm run build
|
||||
|
||||
RUN npx prisma generate
|
||||
RUN npx prisma migrate deploy
|
||||
ENTRYPOINT [ "node", "dist/index.js" ]
|
||||
CMD ["start"]
|
||||
|
|
|
|||
1421
package-lock.json
generated
1421
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "nsecbunkerd",
|
||||
"version": "0.6.1",
|
||||
"version": "0.6.2",
|
||||
"description": "nsecbunker daemon",
|
||||
"main": "dist/index.js",
|
||||
"bin": {
|
||||
|
|
@ -39,10 +39,7 @@
|
|||
"@prisma/client": "^4.16.1",
|
||||
"@scure/base": "^1.1.1",
|
||||
"@types/yargs": "^17.0.24",
|
||||
"@typescript-eslint/eslint-plugin": "^5.60.0",
|
||||
"@typescript-eslint/parser": "^5.60.0",
|
||||
"dotenv": "^16.3.1",
|
||||
"eslint": "^8.43.0",
|
||||
"eslint-config-prettier": "^8.8.0",
|
||||
"eslint-plugin-import": "^2.27.5",
|
||||
"eventemitter3": "^5.0.1",
|
||||
|
|
|
|||
3
pnpm-lock.yaml
generated
3
pnpm-lock.yaml
generated
|
|
@ -32,9 +32,6 @@ dependencies:
|
|||
dotenv:
|
||||
specifier: ^16.3.1
|
||||
version: 16.3.1
|
||||
eslint:
|
||||
specifier: ^8.43.0
|
||||
version: 8.43.0
|
||||
eslint-config-prettier:
|
||||
specifier: ^8.8.0
|
||||
version: 8.8.0(eslint@8.43.0)
|
||||
|
|
|
|||
BIN
prisma/nsecbunker.db
Normal file
BIN
prisma/nsecbunker.db
Normal file
Binary file not shown.
|
|
@ -8,6 +8,7 @@ import createNewKey from './commands/create_new_key';
|
|||
import createNewPolicy from './commands/create_new_policy';
|
||||
import createNewToken from './commands/create_new_token';
|
||||
import unlockKey from './commands/unlock_key';
|
||||
import fs from 'fs';
|
||||
|
||||
export type IAdminOpts = {
|
||||
npubs: string[];
|
||||
|
|
@ -47,6 +48,9 @@ class AdminInterface {
|
|||
|
||||
console.log(`\n\nnsecBunker connection string:\n\n${connectionString}\n\n`);
|
||||
|
||||
// write connection string to connection.txt
|
||||
fs.writeFileSync('connection.txt', connectionString);
|
||||
|
||||
this.signerUser = user;
|
||||
|
||||
this.connect();
|
||||
|
|
|
|||
|
|
@ -44,8 +44,6 @@ function getKeys(config: DaemonConfig) {
|
|||
keys.push(key);
|
||||
}
|
||||
|
||||
console.log({ lockedKeyNames });
|
||||
|
||||
for (const name of lockedKeyNames) {
|
||||
keys.push({ name });
|
||||
}
|
||||
|
|
@ -213,14 +211,10 @@ class Daemon {
|
|||
await this.ndk.connect(5000);
|
||||
|
||||
setTimeout(async () => {
|
||||
const promise = [];
|
||||
|
||||
for (const [name, nsec] of Object.entries(this.config.keys)) {
|
||||
promise.push(this.startKey(name, nsec));
|
||||
await this.startKey(name, nsec);
|
||||
}
|
||||
|
||||
// await Promise.all(promise);
|
||||
|
||||
console.log('✅ nsecBunker ready to serve requests.');
|
||||
}, 1000);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
/* Strict Type-Checking Options */
|
||||
"strict": true /* Enable all strict type-checking options. */,
|
||||
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
||||
"noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */
|
||||
// "strictNullChecks": true, /* Enable strict null checks. */
|
||||
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
||||
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue