From 33fb9703f7a8f1056941a410b5b624f1a3dc6e3f Mon Sep 17 00:00:00 2001 From: Nour <1257310+nourspace@users.noreply.github.com> Date: Fri, 26 Jan 2024 15:13:26 +0000 Subject: [PATCH] feat: use dynamic DATABASE_URL for Prisma db --- .env.example | 4 ++-- README.md | 12 +++++++----- prisma/schema.prisma | 4 ++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.env.example b/.env.example index 17fb0b8..15e6bcf 100644 --- a/.env.example +++ b/.env.example @@ -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... diff --git a/README.md b/README.md index a998bc6..e3ca161 100644 --- a/README.md +++ b/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 diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 4bea2f9..e8b5344 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -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 {