#!/bin/bash 

function Config_Agent {
    agent_root=$1
    agent_server=$2
    agent_hub_uri=$3

    server_placeholder="###SERVERURL###"
    agent_hub_placeholder="###AGENTHUBURL###"
    config_path="$agent_root/service/appsettings.json"

    if [ -s "$config_path" ]
    then
        sed -E -i "s!$server_placeholder!$agent_server!g" "$config_path"
        sed -E -i "s!$agent_hub_placeholder!$agent_hub_uri!g" "$config_path"
    else
        Write_Log "Agent config file not found. Check Agent installation" "ERROR"
        return 1
    fi
}
