feat: use dynamic DATABASE_URL for Prisma db

This commit is contained in:
Nour 2024-01-26 15:13:26 +00:00
commit 33fb9703f7
No known key found for this signature in database
GPG key ID: 9744560DE7DA09AE
3 changed files with 11 additions and 9 deletions

View file

@ -4,8 +4,8 @@
# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB. # 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 # See the documentation for all the connection string options: https://pris.ly/d/connection-strings
# Enable to use different location for dev db file # Change to use different location for dev db file
# DATABASE_URL="file:./dev.db" DATABASE_URL="file:$HOME/.nsecbunker-config/nsecbunker.db"
# Add your admin Nostr npub # Add your admin Nostr npub
# ADMIN_NPUBS=npub1q2s369... # ADMIN_NPUBS=npub1q2s369...

View file

@ -7,13 +7,15 @@ To quickly install `nsecbunkerd` via Docker just run:
### Configurations ### Configurations
Prepare your config directory - Prepare your config directory
```shell ```shell
mkdir $HOME/.nsecbunker-config 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 ```shell
cp .env.example .env cp .env.example .env

View file

@ -1,11 +1,11 @@
generator client { generator client {
provider = "prisma-client-js" 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 { datasource db {
provider = "sqlite" provider = "sqlite"
url = "file:../config/nsecbunker.db" url = env("DATABASE_URL")
} }
model Request { model Request {