From 298439c434f4ed5a237bb11da90e42e134bafc8a Mon Sep 17 00:00:00 2001 From: Sven Ullmann Date: Wed, 5 Jul 2023 01:24:30 +0200 Subject: [PATCH] refactoring --- plugins/git/src/commands/clone | 7 ++----- src/includes/main_functions | 7 +++---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/plugins/git/src/commands/clone b/plugins/git/src/commands/clone index 74151ba..8778a13 100644 --- a/plugins/git/src/commands/clone +++ b/plugins/git/src/commands/clone @@ -22,6 +22,7 @@ sshDomain="$(getConfig $shortname "git.ssh_domain")" sshPrivateKey="$(getConfig $shortname "git.ssh_private_key")" sshPublicKey="$(getConfig $shortname "git.ssh_public_key")" sshPrivateKeyPassphrase="$(getCryptedConfig $shortname "git.ssh_private_key_passphrase")" +workspaces_dir="$(getConfig false "project_manager.workspaces_dir")" if [ "$url" == "" ] then @@ -54,11 +55,7 @@ confirm if [ ! -d "$workspaces_dir/$customer/$project" ] then - echo - echoError "Wprkspace dir not exists" - echo - exit + mkdir -p "$workspaces_dir/$customer/$project" fi -sshAddKey "git" git clone "$url" "$workspaces_dir/$customer/$project" \ No newline at end of file diff --git a/src/includes/main_functions b/src/includes/main_functions index b753b4a..cc886a7 100644 --- a/src/includes/main_functions +++ b/src/includes/main_functions @@ -194,8 +194,7 @@ then then echo "$(getConfig "$shortname" "project_manager.cryptkey")" else - escapedShortname=${shortname//./\\.} - echo "$(getConfig "$shortname" "project_manager.projects.$escapedShortname.cryptkey")" + echo "$(getConfig "$shortname" "project.cryptkey")" fi } @@ -210,7 +209,7 @@ then readCryptedConfig "$shortname" "$configPath" fi - echo "$(decrypt "$(getConfig "$shortname" "$configPath")" "$cryptkey")" + echo decrypt "$(getConfig "$shortname" "$configPath")" "$cryptkey" } function getConfig { @@ -287,7 +286,7 @@ then { local password="$(getArgument "$1" "password required" true)" local cryptkey="$(getArgument "$2" "crypt key required" true)" - echo "$password" | openssl enc -da -nosalt -nopad -pbkdf2 -k "$cryptkey" + echo "$password" | openssl enc -d -base64 -nosalt -nopad -pbkdf2 -k "$cryptkey" } function randkey