mirror of
https://github.com/bubblecup-12/VogelSocialMedia.git
synced 2025-07-06 06:18:50 +00:00
added some comments
This commit is contained in:
parent
2c4114ec0c
commit
7f235e97a8
2 changed files with 4 additions and 4 deletions
|
@ -1,3 +1,4 @@
|
|||
# This is an example of a .env file. You don`t need it unless you fuck up the .env file generated by the install script
|
||||
DATABASE_URL="postgres://postgres:YourPassword@localhost:5432/prisma"
|
||||
TOKEN_SECRET=ThisIsVeryImportantChangeThisToSomethingSecureThisIsUsedToEncryptTheJWT
|
||||
DB_USER=postgres
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
// this script is used to install the project
|
||||
import { exec } from "child_process";
|
||||
import util from "util";
|
||||
const execPromise = util.promisify(exec);
|
||||
import fs, { read } from "fs";
|
||||
import readlineSync from "readline-sync";
|
||||
import crypto from "crypto";
|
||||
import dotenv from "dotenv"
|
||||
import path from "path";
|
||||
|
||||
const json_path: string = "scripts/install.json"; // Path to the JSON file
|
||||
const raw = fs.readFileSync(json_path, "utf8");
|
||||
const config = JSON.parse(raw); // Parse the JSON file
|
||||
|
||||
//check if there is a .env file and abort the installation
|
||||
if (fs.existsSync(".env") ) {
|
||||
if (fs.existsSync(".env")) {
|
||||
// Check if the script has already been run
|
||||
console.log("Already installed");
|
||||
process.exit(0);
|
||||
|
@ -30,7 +29,7 @@ while (!postgresPassword) {
|
|||
});
|
||||
!postgresPassword && console.log("Password cannot be empty");
|
||||
}
|
||||
// getting user input for .env file
|
||||
// generating a random JWT secret
|
||||
const jwtSecret: string = crypto.randomBytes(32).toString("hex"); // 64 Zeichen
|
||||
const env: string = `DATABASE_URL="postgresql://${postgresUser}:${postgresPassword}@localhost:5432/prisma"
|
||||
TOKEN_SECRET="${jwtSecret}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue