Skip to content

Commit

Permalink
add cmd line arg parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
obs-gh-mattcotter committed Dec 11, 2024
1 parent 1885971 commit 64e9207
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions scripts/install_mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,38 @@ service_name="com.observeinc.agent"
observeagent_install_dir="/usr/local/observe-agent"
tmp_dir="/tmp/observe-agent"

# Parse args
while [ $# -gt 0 ]; do
opt=$1
shift
arg=""
if [[ "$opt" == *"="* ]]; then
arg=$(echo $opt | cut -d'=' -f2)
opt=$(echo $opt | cut -d'=' -f1)
elif [ $# -gt 0 ]; then
arg="$1"
shift
fi
case "$opt" in
--token)
TOKEN="$arg"
;;
--observe_url)
OBSERVE_URL="$arg"
;;
--logs_enabled)
LOGS_ENABLED="$arg"
;;
--metrics_enabled)
METRICS_ENABLED="$arg"
;;
*)
echo "Unknown option: $opt"
exit 1
;;
esac
done

# If the observe-agent.yaml file already exists, leave it alone.
# Otherwise we need to know what the collection endpoint and token are.
if [ ! -f "$observeagent_install_dir/observe-agent.yaml" ]; then
Expand Down

0 comments on commit 64e9207

Please sign in to comment.