Skip to content

Commit

Permalink
update URL building
Browse files Browse the repository at this point in the history
  • Loading branch information
agardnerIT committed Sep 27, 2024
1 parent cd5b2c2 commit b1dfe55
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion runtimeChange.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,32 @@

echo "Changing feature flag key: $2 to $3 for service: $1"

# Build URL from parts
full_apps_url="https://${DT_ENV_ID_OBSLAB_LOG_PROBLEM_DETECTION}"
full_gen2_url=""

if [ "${DT_ENV_OBSLAB_LOG_PROBLEM_DETECTION}" = "dev" ]; then
echo "environment is dev"
full_apps_url+=".dev.apps.dynatracelabs.com"
# Remove apps.
full_gen2_url=${full_apps_url/apps.}
elif [ "${DT_ENV_OBSLAB_LOG_PROBLEM_DETECTION}" = "sprint" ]; then
echo "environment is sprint"
full_apps_url+=".sprint.apps.dynatracelabs.com"
# Remove apps.
full_gen2_url=${full_apps_url/apps.}
else
echo "DT_ENV_OBSLAB_LOG_PROBLEM_DETECTION is either 'live' or some other value. Defaulting to live"
full_apps_url+=".apps.dynatrace.com"
full_gen2_url=${full_apps_url/.apps./.live.}
fi

##############
# Step 1
# Inform Dynatrace that a configuration change is occurring
##############

curl -X POST "$DT_URL_OBSLAB_LOG_PROBLEM_DETECTION/api/v2/events/ingest" \
curl -X POST "$full_gen2_url/api/v2/events/ingest" \
-H "accept: application/json; charset=utf-8" -H "Authorization: Api-Token $DT_API_TOKEN_OBSLAB_LOG_PROBLEM_DETECTION" -H "Content-Type: application/json; charset=utf-8" \
-d "{
\"title\": \"feature flag changed\",
Expand Down

0 comments on commit b1dfe55

Please sign in to comment.