Refactor key generation logic and add option to disable key generation
This commit is contained in:
7
index.js
7
index.js
@@ -18,6 +18,8 @@ require("dotenv").config()
|
||||
const GIT_URI = process.env.GIT_URI
|
||||
const GIT_BRANCH = process.env.GIT_BRANCH || "main"
|
||||
|
||||
const shouldGenerateKeys = process.env.GENERATE_KEYS || GIT_URI.startsWith("ssh://") || false
|
||||
|
||||
const PROJECT_DIR = resolvePath(__dirname + "\\project")
|
||||
|
||||
const KEY_DIR = resolvePath(__dirname + "\\keys")
|
||||
@@ -51,6 +53,11 @@ async function tryGenerateKeys() {
|
||||
console.log("no need to generate key, already exists")
|
||||
return;
|
||||
}
|
||||
if (!shouldGenerateKeys) {
|
||||
console.log("shouldGenerateKeys is false, skipping key generation")
|
||||
return;
|
||||
}
|
||||
console.log("Generating keys...")
|
||||
const aPromise = new Promise(function(resolve, reject) {
|
||||
keygen({
|
||||
location: KEY_LOCATION,
|
||||
|
||||
Reference in New Issue
Block a user