# SPDX-License-Identifier: CDDL-1.0
#
# CDDL HEADER START
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source.  A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
# CDDL HEADER END
#

#
# Copyright (c) 2017 Datto, Inc. All rights reserved.
#

# $PASSPHRASE, $HEXKEY, and $RAWKEY must be kept in sync
# with the corresponding files in this directory

export PASSPHRASE="password"
export PASSPHRASE1="password1"
export PASSPHRASE2="password2"
export HEXKEY="000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F"
export HEXKEY1="201F1E1D1C1B1A191817161514131211100F0E0D0C0B0A090807060504030201"
export RAWKEY="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
export RAWKEY1="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"

export SSL_CA_CERT_FILE="/$TESTPOOL/snakeoil.crt"
export HTTPS_PORT_FILE="/$TESTPOOL/snakeoil.port"
export HTTPS_HOSTNAME="localhost"
export HTTPS_PORT=
export HTTPS_BASE_URL=

function get_https_port
{
	if [ -z "$HTTPS_PORT" ]; then
		read -r HTTPS_PORT < "$HTTPS_PORT_FILE" || return
	fi

	echo "$HTTPS_PORT"
}

function get_https_base_url
{
	if [ -z "$HTTPS_BASE_URL" ]; then
		HTTPS_BASE_URL="https://$HTTPS_HOSTNAME:$(get_https_port)" || {
			typeset ret=$?
			HTTPS_BASE_URL=
			return $ret
		}
	fi

	echo "$HTTPS_BASE_URL"
}
