#!/bin/sh

set -e

# Load debconf
. /usr/share/debconf/confmodule

db_input critical libo365connect-aosi-aai/azure2msgraph || true
db_go || true

db_get libo365connect-aosi-aai/azure2msgraph || true
azure2msgraph="$RET"
db_go || true

if [ "$azure2msgraph" = "false" ]; then
  db_go || true
  db_stop || true
  exit
fi

db_input high libo365connect-aosi-aai/enable || true
db_go || true

db_get libo365connect-aosi-aai/enable || true
enable="$RET"

if [ "$enable" = "true" ]; then
  db_input high libo365connect-aosi-aai/ofc_clientID || true
  db_input high libo365connect-aosi-aai/ofc_clientSecret || true
fi

db_go || true
db_stop || true
