added some comments

This commit is contained in:
Kai Ritthaler 2025-05-18 19:36:42 +02:00 committed by Rudi Regentonne
parent 00a7af61a2
commit 15ccb27a26
2 changed files with 4 additions and 4 deletions

View file

@ -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}"