Skip to content

Commit

Permalink
Merge branch 'braking-change-update-prisma-client' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
aiji42 committed Jul 4, 2022
2 parents dafefca + 26080dc commit 54ec0da
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 13 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,6 @@ FROM base

COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/prisma/schema.prisma ./prisma/schema.prisma

ENV PRISMA_SCHEMA_PATH=/app/prisma/schema.prisma

USER node

Expand Down Expand Up @@ -225,7 +222,6 @@ Then set the `DATABASE_URL` and `DATA_PROXY_API_KEY` as environment variables an

![](./images/vercel.png)

- `PRISMA_SCHEMA_PATH`: TODO
- `DATABASE_URL`: Connection URL to your data source (mysql, postgres, etc...)
- `DATA_PROXY_API_KEY`: Arbitrary string to be used when connecting data proxy. e.g. `prisma://your.deployed.domain?api_key={DATA_PROXY_API_KEY}`
(do not divulge it to outside parties)
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ services:
entrypoint: /app/entrypoint.sh
command: ./wait-for-it.sh https-portal3000:443 --timeout=120 --strict -- yarn dev:server
environment:
PRISMA_SCHEMA_PATH: /app/prisma/schema.prisma
DATABASE_URL: postgresql://postgres:pass@db:5432/postgres?schema=public
DATA_PROXY_API_KEY: custometoken
MIGRATE: "true"
Expand Down
9 changes: 1 addition & 8 deletions src/server.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
#! /usr/bin/env node
import { PrismaClient } from "@prisma/client";
import { getDMMF, getSchemaSync } from "@prisma/sdk";
import * as path from "path";
import express from "express";
import { ApolloServer } from "apollo-server-express";
import { afterMiddleware, makeServerConfig, beforeMiddleware } from "./";
import { config } from "dotenv";
config();

const schemaPath =
process.env.PRISMA_SCHEMA_PATH ?? path.join(__dirname, "./schema.prisma");
const schema = getSchemaSync(
schemaPath.startsWith("/") ? schemaPath : path.join(__dirname, schemaPath)
);

const db = new PrismaClient(
process.env.NODE_ENV === "production"
? undefined
Expand All @@ -32,7 +25,7 @@ app.use(afterMiddleware());

(async () => {
const dmmf = await getDMMF({
datamodel: schema,
datamodel: getSchemaSync(),
});
const server = new ApolloServer({
...makeServerConfig(dmmf, db),
Expand Down

0 comments on commit 54ec0da

Please sign in to comment.