Skip to content

Commit

Permalink
added the credenatails file creation into initiate files
Browse files Browse the repository at this point in the history
  • Loading branch information
erikpersson0884 committed May 20, 2024
1 parent 54fe368 commit cd20315
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ export async function initialize_files(directories, files) {
fs.writeFileSync(path, JSON.stringify([], null, 2));
}
});

// Create credentials file if it doesn't exist
if (!fs.existsSync(pathToCredentialsFile)) {
fs.writeFileSync(pathToCredentialsFile, JSON.stringify([
{
"name": process.env.MAIN_USERNAME || "Göken",
"password": process.env.MAIN_USER_PASSWORD || "1234",
"id": process.env.MAIN_USER_ID || "1"
}
], null, 2));
}
}

async function initiate_commitee_file() {
Expand Down Expand Up @@ -80,21 +91,9 @@ async function initiate_commitee_file() {
}
}

async function initiate_credentials_file() {
if (!fs.existsSync(pathToCredentialsFile)) {
fs.writeFileSync(pathToCredentialsFile, JSON.stringify([
{
"name": process.env.MAIN_USERNAME || "Göken",
"password": process.env.MAIN_USER_PASSWORD || "1234",
"id": process.env.MAIN_USER_ID || "1"
}
], null, 2));
}
}

initialize_files([dataFolderPath, pathToPatetosImages, pathToPostImages], [pathToPostsFile, pathToPatetosFile, pathToAdminkeysFile]);
initiate_commitee_file();
initiate_credentials_file();


// LOGIN SYSTEM
Expand Down

0 comments on commit cd20315

Please sign in to comment.