<?php
	//$oms = mocha_get_oms();

	$path = $_SERVER["REQUEST_URI"];
	$parts = explode("/", $path);
	$tenantName = null;
	
	if (count($parts) > 3 && $parts[1] == "madi" && $parts[2] == "authgwy")
	{
		$tenantName = $parts[3];
	}
	else if (count($parts) > 1)
	{
		$tenantName = $parts[1];
	}
	
	//if ($oms !== null)
	{
		//$tenantName = $oms->getTenantName();
	}
	$cdn_url = "static.alcehosting.net";
	$tenant_environment_text = "Implementation  -   " . $tenantName;

	function expandUrl($path = "")
	{
		$ret = $_SERVER["REQUEST_SCHEME"] . "://" . $_SERVER["SERVER_NAME"];
		if ($path != "")
		{
			$ret .= "/" . $path;
		}
		return $ret;
	}
?>
// Add properties to mocha
window.mocha = window.mocha || {};
mocha.tenant = '<?php echo($tenantName); ?>';
mocha.clientOrigin = '<?php echo(expandUrl()); ?>';
mocha.language = 'en_US';
mocha.clientVersion = '0';
mocha.systemConfidenceLevel = 'PROD';
mocha.oauthAuthorizationPending = false;
mocha.proxyLoginEnabled = false;
mocha.maintenancePageUrl = '<?php echo(expandUrl()); ?>/madi/drs/outage?t=<?php echo($tenantName); ?>';
mocha.deviceTrustDetailsUrl = '';
mocha.pendingAuthDetailsUrl = '';
mocha.webAuthnDetailsUrl = '';
mocha.enableBluePrimaryButtons = 'false';

// Construct init params for GWT app
mocha.initParams = {
	authGatewayPath: '/madi/authgwy',
	baseDir: '/madi/asset/ui-html/',
	systemConfidenceLevel: 'PROD',
	cdn: {
		endpoint: '<?php echo($cdn_url); ?>',
		enabled: true,
		allowed: true
	},
	proxyEnabled: false,
	currentVersion: '20.0.04.045',
	serviceType: 'authgwy',
	loginAuthURL: '/<?php echo($tenantName); ?>/login-auth.xml',
	environment: '<?php echo($tenant_environment_text); ?>',
	environmentType: 'IMPL'
};