mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
Add prisma script to remove env files
This commit is contained in:
parent
e3d999d7bd
commit
700681314d
11
README.md
11
README.md
|
|
@ -84,9 +84,6 @@ RUN chmod +x /docker-entrypoint-initdb.d/init.sh
|
|||
5. Run migrations:
|
||||
|
||||
```bash
|
||||
# Replace this with Postgres credentials
|
||||
# This env file only needs to be there for migrations, it can be deleted after
|
||||
echo "DATABASE_URL=postgres://xxx:xxx@xxx:xxx/xxx" > .env
|
||||
bun migrate
|
||||
```
|
||||
|
||||
|
|
@ -108,6 +105,10 @@ bun cli
|
|||
|
||||
You can use the `help` command to see a list of available commands. These include creating users, deleting users and more.
|
||||
|
||||
### Using Database Commands
|
||||
|
||||
The `bun prisma` commands allows you to use Prisma commands without needing to add in environment variables for the database config. Just run Prisma commands as you would normally, replacing `bunx prisma` with `bun prisma`.
|
||||
|
||||
## With Docker
|
||||
|
||||
> **Note**: Docker is currently broken, as Bun with Prisma does not work well with Docker yet for unknown reasons. The following instructions are for when this is fixed.
|
||||
|
|
@ -122,8 +123,8 @@ You can also run Lysand using Docker. To do so, you can:
|
|||
```bash
|
||||
docker network create lysand-net
|
||||
```
|
||||
4. Fill in the config file and the .env file (see [Installation](#installation))
|
||||
5. Run the following command:
|
||||
1. Fill in the config file (see [Installation](#installation))
|
||||
2. Run the following command:
|
||||
```bash
|
||||
docker-compose up -d
|
||||
```
|
||||
|
|
|
|||
13
package.json
13
package.json
|
|
@ -10,9 +10,9 @@
|
|||
"url": "https://cpluspatch.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/CPlusPatch/lysand/issues"
|
||||
"url": "https://github.com/lysand-org/lysand/issues"
|
||||
},
|
||||
"icon": "https://github.com/CPlusPatch/lysand",
|
||||
"icon": "https://github.com/lysand-org/lysand",
|
||||
"license": "AGPL-3.0",
|
||||
"keywords": [
|
||||
"federated",
|
||||
|
|
@ -28,16 +28,17 @@
|
|||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/CPlusPatch/lysand.git"
|
||||
"url": "git+https://github.com/lysand-org/lysand.git"
|
||||
},
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "bun run index.ts",
|
||||
"start": "bun run index.ts",
|
||||
"migrate-dev": "bunx prisma migrate dev",
|
||||
"migrate": "bunx prisma migrate deploy",
|
||||
"migrate-dev": "bun prisma migrate dev",
|
||||
"migrate": "bun prisma migrate deploy",
|
||||
"lint": "eslint --config .eslintrc.cjs --ext .ts .",
|
||||
"generate": "bunx prisma generate",
|
||||
"prisma": "bun run prisma.ts",
|
||||
"generate": "bun prisma generate",
|
||||
"cli": "bun run cli.ts"
|
||||
},
|
||||
"trustedDependencies": [
|
||||
|
|
|
|||
17
prisma.ts
Normal file
17
prisma.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// Proxies all `bunx prisma` commands with an environment variable
|
||||
|
||||
import { getConfig } from "@config";
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
const config = getConfig();
|
||||
|
||||
const { stdout } = Bun.spawn(["bunx", "prisma", ...args], {
|
||||
env: {
|
||||
...process.env,
|
||||
DATABASE_URL: `postgresql://${config.database.username}:${config.database.password}@${config.database.host}:${config.database.port}/${config.database.database}`,
|
||||
},
|
||||
});
|
||||
|
||||
// Show stdout
|
||||
const text = await new Response(stdout).text();
|
||||
console.log(text); // => "hello"
|
||||
Loading…
Reference in a new issue