diff --git a/Dockerfile b/Dockerfile index dc7a053..1ce45dd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,7 +28,5 @@ COPY --from=backend-builder /opt/app/prisma ./prisma COPY --from=backend-builder /opt/app/package.json ./ WORKDIR /opt/app -RUN npm i -g dotenv-cli - EXPOSE 3000 -CMD cd frontend && dotenv node_modules/.bin/next start & cd backend && npm run prod \ No newline at end of file +CMD cd frontend && node_modules/.bin/next start & cd backend && npm run prod \ No newline at end of file diff --git a/backend/package-lock.json b/backend/package-lock.json index c99b9c1..cdb1b31 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -50,7 +50,6 @@ "@typescript-eslint/eslint-plugin": "^5.40.0", "@typescript-eslint/parser": "^5.40.0", "cross-env": "^7.0.3", - "dotenv-cli": "^6.0.0", "eslint": "^8.25.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-prettier": "^4.0.0", @@ -2818,21 +2817,6 @@ "node": ">=12" } }, - "node_modules/dotenv-cli": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/dotenv-cli/-/dotenv-cli-6.0.0.tgz", - "integrity": "sha512-qXlCOi3UMDhCWFKe0yq5sg3X+pJAz+RQDiFN38AMSbUrnY3uZshSfDJUAge951OS7J9gwLZGfsBlWRSOYz/TRg==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.3", - "dotenv": "^16.0.0", - "dotenv-expand": "^8.0.1", - "minimist": "^1.2.5" - }, - "bin": { - "dotenv": "cli.js" - } - }, "node_modules/dotenv-expand": { "version": "8.0.3", "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-8.0.3.tgz", @@ -9527,18 +9511,6 @@ "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.1.tgz", "integrity": "sha512-1K6hR6wtk2FviQ4kEiSjFiH5rpzEVi8WW0x96aztHVMhEspNpc4DVOUTEHtEva5VThQ8IaBX1Pe4gSzpVVUsKQ==" }, - "dotenv-cli": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/dotenv-cli/-/dotenv-cli-6.0.0.tgz", - "integrity": "sha512-qXlCOi3UMDhCWFKe0yq5sg3X+pJAz+RQDiFN38AMSbUrnY3uZshSfDJUAge951OS7J9gwLZGfsBlWRSOYz/TRg==", - "dev": true, - "requires": { - "cross-spawn": "^7.0.3", - "dotenv": "^16.0.0", - "dotenv-expand": "^8.0.1", - "minimist": "^1.2.5" - } - }, "dotenv-expand": { "version": "8.0.3", "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-8.0.3.tgz", diff --git a/backend/package.json b/backend/package.json index f349aa9..a58b3a3 100644 --- a/backend/package.json +++ b/backend/package.json @@ -3,11 +3,11 @@ "version": "0.0.1", "scripts": { "build": "nest build", - "dev": "dotenv -- nest start --watch", - "prod": "npx prisma migrate deploy && dotenv node dist/main", + "dev": "nest start --watch", + "prod": "prisma migrate deploy && prisma db seed && node dist/src/main", "lint": "eslint 'src/**/*.ts'", "format": "prettier --write 'src/**/*.ts'", - "test:system": "npx prisma migrate reset -f && nest start & sleep 10 && newman run ./test/system/newman-system-tests.json" + "test:system": "prisma migrate reset -f && nest start & sleep 10 && newman run ./test/system/newman-system-tests.json" }, "prisma": { "seed": "ts-node prisma/seed/config.seed.ts" @@ -55,7 +55,6 @@ "@typescript-eslint/eslint-plugin": "^5.40.0", "@typescript-eslint/parser": "^5.40.0", "cross-env": "^7.0.3", - "dotenv-cli": "^6.0.0", "eslint": "^8.25.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-prettier": "^4.0.0", diff --git a/backend/prisma/seed/config.seed.ts b/backend/prisma/seed/config.seed.ts index a43b14d..d7af208 100644 --- a/backend/prisma/seed/config.seed.ts +++ b/backend/prisma/seed/config.seed.ts @@ -1,5 +1,90 @@ import { PrismaClient } from "@prisma/client"; -import configVariables from "../../src/configVariables"; +import * as crypto from "crypto"; + +const configVariables = [ + { + key: "setupFinished", + description: "Whether the setup has been finished", + type: "boolean", + value: "false", + secret: false, + locked: true, + }, + { + key: "appUrl", + description: "On which URL Pingvin Share is available", + type: "string", + value: "http://localhost:3000", + secret: false, + }, + { + key: "showHomePage", + description: "Whether to show the home page", + type: "boolean", + value: "true", + secret: false, + }, + { + key: "allowRegistration", + description: "Whether registration is allowed", + type: "boolean", + value: "true", + secret: false, + }, + { + key: "allowUnauthenticatedShares", + description: "Whether unauthorized users can create shares", + type: "boolean", + value: "false", + secret: false, + }, + { + key: "maxFileSize", + description: "Maximum file size in bytes", + type: "number", + value: "1000000000", + secret: false, + }, + { + key: "jwtSecret", + description: "Long random string used to sign JWT tokens", + type: "string", + value: crypto.randomBytes(256).toString("base64"), + locked: true, + }, + { + key: "emailRecipientsEnabled", + description: + "Whether to send emails to recipients. Only set this to true if you entered the host, port, email and password of your SMTP server.", + type: "boolean", + value: "false", + secret: false, + }, + { + key: "smtpHost", + description: "Host of the SMTP server", + type: "string", + value: "", + }, + { + key: "smtpPort", + description: "Port of the SMTP server", + type: "number", + value: "", + }, + { + key: "smtpEmail", + description: "Email address of the SMTP server", + type: "string", + value: "", + }, + { + key: "smtpPassword", + description: "Password of the SMTP server", + type: "string", + value: "", + }, +]; const prisma = new PrismaClient(); diff --git a/backend/src/configVariables.ts b/backend/src/configVariables.ts deleted file mode 100644 index b11be41..0000000 --- a/backend/src/configVariables.ts +++ /dev/null @@ -1,88 +0,0 @@ -import * as crypto from "crypto"; - -const configVariables = [ - { - key: "setupFinished", - description: "Whether the setup has been finished", - type: "boolean", - value: "false", - secret: false, - locked: true, - }, - { - key: "appUrl", - description: "On which URL Pingvin Share is available", - type: "string", - value: "http://localhost:3000", - secret: false, - }, - { - key: "showHomePage", - description: "Whether to show the home page", - type: "boolean", - value: "true", - secret: false, - }, - { - key: "allowRegistration", - description: "Whether registration is allowed", - type: "boolean", - value: "true", - secret: false, - }, - { - key: "allowUnauthenticatedShares", - description: "Whether unauthorized users can create shares", - type: "boolean", - value: "false", - secret: false, - }, - { - key: "maxFileSize", - description: "Maximum file size in bytes", - type: "number", - value: "1000000000", - secret: false, - }, - { - key: "jwtSecret", - description: "Long random string used to sign JWT tokens", - type: "string", - value: crypto.randomBytes(256).toString("base64"), - locked: true, - }, - { - key: "emailRecipientsEnabled", - description: - "Whether to send emails to recipients. Only set this to true if you entered the host, port, email and password of your SMTP server.", - type: "boolean", - value: "false", - secret: false, - }, - { - key: "smtpHost", - description: "Host of the SMTP server", - type: "string", - value: "", - }, - { - key: "smtpPort", - description: "Port of the SMTP server", - type: "number", - value: "", - }, - { - key: "smtpEmail", - description: "Email address of the SMTP server", - type: "string", - value: "", - }, - { - key: "smtpPassword", - description: "Password of the SMTP server", - type: "string", - value: "", - }, -]; - -export default configVariables; diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 7c809a1..d25ae72 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -36,7 +36,6 @@ "@types/react": "18.0.4", "@types/react-dom": "18.0.0", "axios": "^0.26.1", - "dotenv-cli": "^6.0.0", "eslint": "8.13.0", "eslint-config-next": "^13.0.0", "eslint-config-prettier": "^8.5.0", @@ -3789,39 +3788,6 @@ "url": "https://github.com/fb55/domutils?sponsor=1" } }, - "node_modules/dotenv": { - "version": "16.0.3", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz", - "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==", - "dev": true, - "engines": { - "node": ">=12" - } - }, - "node_modules/dotenv-cli": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/dotenv-cli/-/dotenv-cli-6.0.0.tgz", - "integrity": "sha512-qXlCOi3UMDhCWFKe0yq5sg3X+pJAz+RQDiFN38AMSbUrnY3uZshSfDJUAge951OS7J9gwLZGfsBlWRSOYz/TRg==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.3", - "dotenv": "^16.0.0", - "dotenv-expand": "^8.0.1", - "minimist": "^1.2.5" - }, - "bin": { - "dotenv": "cli.js" - } - }, - "node_modules/dotenv-expand": { - "version": "8.0.3", - "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-8.0.3.tgz", - "integrity": "sha512-SErOMvge0ZUyWd5B0NXMQlDkN+8r+HhVUsxgOO7IoPDOdDRD2JjExpN6y3KnFR66jsJMwSn1pqIivhU5rcJiNg==", - "dev": true, - "engines": { - "node": ">=12" - } - }, "node_modules/duplexer2": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", @@ -10506,30 +10472,6 @@ "domhandler": "^4.2.0" } }, - "dotenv": { - "version": "16.0.3", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz", - "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==", - "dev": true - }, - "dotenv-cli": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/dotenv-cli/-/dotenv-cli-6.0.0.tgz", - "integrity": "sha512-qXlCOi3UMDhCWFKe0yq5sg3X+pJAz+RQDiFN38AMSbUrnY3uZshSfDJUAge951OS7J9gwLZGfsBlWRSOYz/TRg==", - "dev": true, - "requires": { - "cross-spawn": "^7.0.3", - "dotenv": "^16.0.0", - "dotenv-expand": "^8.0.1", - "minimist": "^1.2.5" - } - }, - "dotenv-expand": { - "version": "8.0.3", - "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-8.0.3.tgz", - "integrity": "sha512-SErOMvge0ZUyWd5B0NXMQlDkN+8r+HhVUsxgOO7IoPDOdDRD2JjExpN6y3KnFR66jsJMwSn1pqIivhU5rcJiNg==", - "dev": true - }, "duplexer2": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", diff --git a/frontend/package.json b/frontend/package.json index 6aa77af..4087ccc 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -2,9 +2,9 @@ "name": "pingvin-share", "version": "0.0.1", "scripts": { - "dev": "dotenv next dev", + "dev": "next dev", "build": "next build", - "start": "dotenv next start", + "start": "next start", "lint": "next lint", "format": "prettier --write \"src/**/*.ts*\"" }, @@ -37,7 +37,6 @@ "@types/react": "18.0.4", "@types/react-dom": "18.0.0", "axios": "^0.26.1", - "dotenv-cli": "^6.0.0", "eslint": "8.13.0", "eslint-config-next": "^13.0.0", "eslint-config-prettier": "^8.5.0", diff --git a/frontend/src/pages/_app.tsx b/frontend/src/pages/_app.tsx index f76d1af..22e6fc7 100644 --- a/frontend/src/pages/_app.tsx +++ b/frontend/src/pages/_app.tsx @@ -51,7 +51,7 @@ function App({ Component, pageProps }: AppProps) { configVariables.filter((variable) => variable.key)[0].value == "false" && !["/auth/signUp", "/admin/setup"].includes(router.asPath) ) { - router.push(!user ? "/auth/signUp" : "admin/setup"); + router.push(!user ? "/auth/signUp" : "/admin/setup"); } }, [router.asPath]);