mirror of
https://github.com/aljazceru/nsecbunkerd.git
synced 2025-12-17 06:04:22 +01:00
Merge pull request #28 from nourspace/nour/feat/improved-configs
feat: improved configs
This commit is contained in:
@@ -4,8 +4,8 @@
|
||||
# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
|
||||
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings
|
||||
|
||||
# Enable to use different location for dev db file
|
||||
# DATABASE_URL="file:./dev.db"
|
||||
# Change to use different location for dev db file
|
||||
DATABASE_URL="file:$HOME/.nsecbunker-config/nsecbunker.db"
|
||||
|
||||
# Add your admin Nostr npub
|
||||
# ADMIN_NPUBS=npub1q2s369...
|
||||
|
||||
14
README.md
14
README.md
@@ -7,13 +7,15 @@ To quickly install `nsecbunkerd` via Docker just run:
|
||||
|
||||
### Configurations
|
||||
|
||||
Prepare your config directory
|
||||
- Prepare your config directory
|
||||
|
||||
```shell
|
||||
mkdir $HOME/.nsecbunker-config
|
||||
```
|
||||
|
||||
```shell
|
||||
mkdir $HOME/.nsecbunker-config
|
||||
```
|
||||
- Clone `.env.example` and add your nostr public key to `ADMIN_NPUBS` to the `.env` file.
|
||||
|
||||
Clone `.env.example` and add your nostr public key to `ADMIN_NPUBS` to the `.env` file.
|
||||
- Change `DATABASE_URL` if necessary.
|
||||
|
||||
```shell
|
||||
cp .env.example .env
|
||||
@@ -38,7 +40,7 @@ docker compose up -d
|
||||
### Get the connection string
|
||||
|
||||
```shell
|
||||
docker compose exec nsecbunkerd cat /app/connection.txt
|
||||
docker compose exec nsecbunkerd cat /app/config/connection.txt
|
||||
```
|
||||
|
||||
nsecBunker will give you a connection string like:
|
||||
|
||||
@@ -11,7 +11,7 @@ services:
|
||||
volumes:
|
||||
- $HOME/.nsecbunker-config:/app/config
|
||||
env_file:
|
||||
- .env.example
|
||||
- .env
|
||||
ports:
|
||||
- "3000:3000"
|
||||
depends_on:
|
||||
@@ -22,7 +22,7 @@ services:
|
||||
volumes:
|
||||
- $HOME/.nsecbunker-config:/app/config
|
||||
env_file:
|
||||
- .env.example
|
||||
- .env
|
||||
restart: no
|
||||
entrypoint: ""
|
||||
command:
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
binaryTargets = ["native", "linux-musl-arm64-openssl-3.0.x"]
|
||||
binaryTargets = ["native", "linux-musl-openssl-3.0.x", "linux-musl-arm64-openssl-3.0.x"]
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "sqlite"
|
||||
url = "file:../config/nsecbunker.db"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
model Request {
|
||||
|
||||
@@ -33,6 +33,7 @@ export interface IConfig {
|
||||
};
|
||||
admin: IAdminOpts;
|
||||
authPort?: number;
|
||||
authHost?: string;
|
||||
database: string;
|
||||
logs: string;
|
||||
keys: Record<string, any>;
|
||||
@@ -49,6 +50,7 @@ const defaultConfig: IConfig = {
|
||||
]
|
||||
},
|
||||
authPort: 3000,
|
||||
authHost: 'localhost',
|
||||
admin: {
|
||||
npubs: [],
|
||||
adminRelays: [
|
||||
|
||||
@@ -17,6 +17,8 @@ import fs from 'fs';
|
||||
import { validateRequestFromAdmin } from './validations/request-from-admin';
|
||||
import { dmUser } from '../../utils/dm-user';
|
||||
import { IConfig, getCurrentConfig } from "../../config";
|
||||
import path from 'path';
|
||||
|
||||
|
||||
const debug = createDebug("nsecbunker:admin");
|
||||
|
||||
@@ -63,7 +65,8 @@ class AdminInterface {
|
||||
console.log(`\n\nnsecBunker connection string:\n\n${connectionString}\n\n`);
|
||||
|
||||
// write connection string to connection.txt
|
||||
fs.writeFileSync('connection.txt', connectionString);
|
||||
const configFolder = path.dirname(configFile)
|
||||
fs.writeFileSync(path.join(configFolder, 'connection.txt'), connectionString);
|
||||
|
||||
this.signerUser = user;
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ class Daemon {
|
||||
}
|
||||
});
|
||||
|
||||
this.fastify.listen({ port: this.config.authPort });
|
||||
this.fastify.listen({ port: this.config.authPort, host: this.config.authHost });
|
||||
|
||||
this.fastify.get('/requests/:id', authorizeRequestWebHandler);
|
||||
this.fastify.post('/requests/:id', processRequestWebHandler);
|
||||
|
||||
Reference in New Issue
Block a user