Skip to content

Commit

Permalink
Stored token curl command in a variable
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcr01 committed Aug 30, 2024
1 parent 948f4d9 commit 2203e04
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions install_functions/manager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ function manager_startCluster() {

function manager_checkService() {
common_logger "Checking Wazuh API connection"
eval "TOKEN=$(curl -k -s -X POST -u "wazuh-wui:wazuh-wui" https://127.0.0.1:55000/security/user/authenticate/run_as?raw=true -d '{"user_name":"wzread"}' -H "content-type:application/json")"
token_command="curl -k -s -X POST -u \"wazuh-wui:wazuh-wui\" https://127.0.0.1:55000/security/user/authenticate/run_as?raw=true -d '{\"user_name\":\"wzread\"}' -H \"content-type:application/json\""
TOKEN=$(eval "${token_command}")

max_attempts=5
attempt=0
Expand All @@ -54,7 +55,7 @@ function manager_checkService() {
attempt=$((attempt+1))
common_logger "Attempt $attempt: Trying to get Wazuh API token"
sleep "${seconds}"
TOKEN=$(curl -k -s -X POST -u "wazuh-wui:wazuh-wui" https://127.0.0.1:55000/security/user/authenticate/run_as?raw=true -d '{"user_name":"wzread"}' -H "content-type:application/json")
TOKEN=$(eval "${token_command}")
done

if [[ -z "${TOKEN}" ]]; then
Expand Down

0 comments on commit 2203e04

Please sign in to comment.