<?php

$base_url = 'https://' . str_replace("extlayer", "svrlayer", $_SERVER["SERVER_NAME"]);
$local_url = 'https://' . $_SERVER["SERVER_NAME"];
$target_url = $base_url . "/internal.php";

$tracklocation_dir = $savvyext->cfgReadChar('system.tracklocation_dir');
$gearmanServers = $savvyext->cfgReadChar('gearman.servers');

$encryptionAlg = $savvyext->cfgReadChar('encryption.algorithm');
$encryptionKey = $savvyext->cfgReadChar('encryption.key');
$encryptionIV = $savvyext->cfgReadChar('encryption.iv');

$httpAuthToken = $savvyext->cfgReadChar('system.oauth2_token');

global $pgconn, $pgconn_gps;
//PostgreSQL
$gps_db_host = $savvyext->cfgReadChar('gpsdatabase.host');
$gps_db_port = $savvyext->cfgReadLong('gpsdatabase.port');
$gps_db_name = $savvyext->cfgReadChar('gpsdatabase.name');
$gps_db_user = $savvyext->cfgReadChar('gpsdatabase.user');
$gps_db_pass = $savvyext->cfgReadChar('gpsdatabase.pass');
$conn_string_gps = "host=${gps_db_host} port=${gps_db_port} dbname=${gps_db_name} user=${gps_db_user} password=${gps_db_pass}";
$pgconn_gps = pg_connect($conn_string_gps);

$db_host = $savvyext->cfgReadChar('database.host');
$db_port = $savvyext->cfgReadLong('database.port');
$db_name = $savvyext->cfgReadChar('database.name');
$db_user = $savvyext->cfgReadChar('database.user');
$db_pass = $savvyext->cfgReadChar('database.pass');
$conn_string = "host=${db_host} port=${db_port} dbname=${db_name} user=${db_user} password=${db_pass}";
$pgconn = pg_connect($conn_string);


if ($pgconn) {
// echo "Okay";
} else {
//echo pg_last_error($pgconn);
}

$autocabApiConfig = [
	'baseUrl' => $savvyext->cfgReadChar('autocab.baseUrl'),
	'agentId' => $savvyext->cfgReadChar('autocab.agentId'),
	'agentPassword' => $savvyext->cfgReadChar('autocab.agentPassword'),
	'currency' => $savvyext->cfgReadChar('autocab.currency'),
	'vendorId' => $savvyext->cfgReadChar('autocab.vendorId'),
	'templatesDir' => $savvyext->cfgReadChar('autocab.templatesDir')
];


