Skip to content

Commit

Permalink
ALS 4884 google analytics (#73)
Browse files Browse the repository at this point in the history
* [ALS-4884] Improve Google Analytics Job
  • Loading branch information
Gcolon021 authored Aug 18, 2023
1 parent f16de7d commit 42d5ac0
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,22 @@
<concurrentBuild>false</concurrentBuild>
<builders>
<hudson.tasks.Shell>
<command>export old_analytics_id=`cat /usr/local/docker-config/httpd/picsureui_settings.json | grep analytics_id | cut -d &apos;:&apos; -f 2 | sed &apos;s/\&quot;,*//g&apos;`
<command>#!/bin/bash

sed -i &quot;s/$old_analytics_id/ANALYTICS_ID/g&quot; /usr/local/docker-config/httpd/picsureui_settings.json
# If the $ANALYTICS_ID variable is blank, set it to __ANALYTICS_ID__
: ${ANALYTICS_ID:="__ANALYTICS_ID__"}

# Check for the presence of the analytics_id key and fetch its value
value=$(jq -r 'select(.analytics_id != null) | .analytics_id' /usr/local/docker-config/httpd/picsureui_settings.json)

# Check if the key is missing
if [[ -z $value ]]; then
# Add the analytics_id key with value of $ANALYTICS_ID
jq --arg ANALYTICS_ID &quot;$ANALYTICS_ID&quot; '. + {&quot;analytics_id&quot;: $ANALYTICS_ID}' /usr/local/docker-config/httpd/picsureui_settings.json > /tmp/temp.json &amp;&amp; mv /tmp/temp.json /usr/local/docker-config/httpd/picsureui_settings.json
else
# Replace the old value with the value of $ANALYTICS_ID
jq --arg ANALYTICS_ID &quot;$ANALYTICS_ID&quot; '.analytics_id = $ANALYTICS_ID' /usr/local/docker-config/httpd/picsureui_settings.json > /tmp/temp.json &amp;&amp; mv /tmp/temp.json /usr/local/docker-config/httpd/picsureui_settings.json
fi
</command>
</hudson.tasks.Shell>
</builders>
Expand Down

0 comments on commit 42d5ac0

Please sign in to comment.