#!/bin/bash

set -f

AKEYLESS_NATIVE_CLI=/bin/akeyless_cli

if [ "$AKEYLESS_API_GW_URL" != "" ]; then
    export AKEYLESS_GATEWAY_URL="$AKEYLESS_API_GW_URL"
fi
[[ "$1" == "auth" || "$1" == "configure" ]] && unset AKEYLESS_GATEWAY_URL

C=''
for i in "$@"; do
    pattern=" "
    if [[ $i =~ $pattern ]]; then
        C="$C \"$i\""
    else
        C="$C $i"
    fi
done
eval $AKEYLESS_NATIVE_CLI $C