update key manager

This commit is contained in:
2025-09-09 16:23:06 +02:00
parent debbd2ba56
commit cdfd292046

View File

@@ -52,19 +52,32 @@ create_new_key() {
read -p "Enter the Key Name [CRONKEY]: " key_name read -p "Enter the Key Name [CRONKEY]: " key_name
read -p "Enter the HANA Host [${current_hostname}]: " hdb_host read -p "Enter the HANA Host [${current_hostname}]: " hdb_host
read -p "Enter the Instance Number [00]: " hdb_instance read -p "Enter the Instance Number [00]: " hdb_instance
read -p "Enter the Tenant DB [NDB]: " hdb_tenant
# Ask if connecting to SYSTEMDB to format the connection string correctly.
read -p "Is this for the SYSTEMDB tenant? (y/n) [n]: " is_systemdb
# Set default values for prompts
key_name=${key_name:-"CRONKEY"}
hdb_host=${hdb_host:-$current_hostname}
hdb_instance=${hdb_instance:-"00"}
is_systemdb=${is_systemdb:-"n"}
# Conditionally build the connection string
if [[ "$is_systemdb" =~ ^[Yy]$ ]]; then
CONNECTION_STRING="${hdb_host}:3${hdb_instance}15"
echo -e "${COLOR_YELLOW}💡 Connecting to SYSTEMDB. Tenant name will be omitted from the connection string.${COLOR_NC}"
else
read -p "Enter the Tenant DB [NDB]: " hdb_tenant
hdb_tenant=${hdb_tenant:-"NDB"}
CONNECTION_STRING="${hdb_host}:3${hdb_instance}15@${hdb_tenant}"
fi
read -p "Enter the Database User [SYSTEM]: " hdb_user read -p "Enter the Database User [SYSTEM]: " hdb_user
read -sp "Enter the Database Password: " hdb_pass read -sp "Enter the Database Password: " hdb_pass
echo "" echo ""
key_name=${key_name:-"CRONKEY"}
hdb_host=${hdb_host:-$current_hostname}
hdb_instance=${hdb_instance:-"00"}
hdb_tenant=${hdb_tenant:-"NDB"}
hdb_user=${hdb_user:-"SYSTEM"} hdb_user=${hdb_user:-"SYSTEM"}
CONNECTION_STRING="${hdb_host}:3${hdb_instance}15@${hdb_tenant}"
echo -e "\n${COLOR_YELLOW}📝 Review the command below (password is hidden):" echo -e "\n${COLOR_YELLOW}📝 Review the command below (password is hidden):"
echo "------------------------------------------------------" echo "------------------------------------------------------"
printf "${HDB_USERSTORE_EXEC} SET \"%s\" \"%s\" \"%s\" \"<password>\"\n" "$key_name" "$CONNECTION_STRING" "$hdb_user" printf "${HDB_USERSTORE_EXEC} SET \"%s\" \"%s\" \"%s\" \"<password>\"\n" "$key_name" "$CONNECTION_STRING" "$hdb_user"
@@ -177,3 +190,4 @@ while true; do
;; ;;
esac esac
done done