From 95ada97b2ffc3cca90b5af40492a6a90bb38167c Mon Sep 17 00:00:00 2001 From: Aaro Varis Date: Mon, 23 Sep 2024 11:52:44 +0300 Subject: [PATCH] Refactor key generation logic and add option to disable key generation --- index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/index.js b/index.js index e1ef9ef..3130eba 100644 --- a/index.js +++ b/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,