#!/bin/bash

set -e

# Replace with the real values
URL="https://idpvserver.demo.gemalto.com/"
TENANT="1e6010d9-cb47-42e6-bfdf-f6b7e2cf1692"

PRODUCT_BUNDLE_IDENTIFIER=~/Library/Containers/com.thalesgroup.IDPV.systray/Data/Library/Preferences/com.thalesgroup.IDPV.systray

DEBUG=false

if $DEBUG
then
	echo -n "old URL: "
	defaults read "$PRODUCT_BUNDLE_IDENTIFIER" URL || true

	echo -n "old tenant: "
	defaults read "$PRODUCT_BUNDLE_IDENTIFIER" tenant || true
	echo
fi

defaults write "$PRODUCT_BUNDLE_IDENTIFIER" URL "$URL"
defaults write "$PRODUCT_BUNDLE_IDENTIFIER" tenant "$TENANT"

if $DEBUG
then
	echo -n "new URL: "
	defaults read "$PRODUCT_BUNDLE_IDENTIFIER" URL

	echo -n "new tenant: "
	defaults read "$PRODUCT_BUNDLE_IDENTIFIER" tenant
fi

