sparqapi/api/application/libraries/key_enc.php
2020-11-13 22:35:03 +05:30

44 lines
999 B
PHP

<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once APPPATH.'/vendor/autoload.php';
use SecureEnvPHP\SecureEnvPHP;
$enc_env = $_SERVER['DOCUMENT_ROOT'].'/env/.env.enc';
$enc_key = $_SERVER['DOCUMENT_ROOT'].'/env/.env.key';
if(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
{
try
{
if(!file_exists($enc_env) || (!file_exists($enc_key)))
{
throw new Exception("Application Environment Variables Not Available..!");
}
}
catch(Exception $e)
{
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
echo $e->getMessage();
exit(1);
}
}
else
{
try
{
if(!file_exists($enc_env) || (!file_exists($enc_key)))
{
throw new Exception("Application Environment Variables Not Available..!");
}
}
catch(Exception $e)
{
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
echo $e->getMessage();
exit(1);
}
}
(new SecureEnvPHP())->parse($enc_env,$enc_key);
// echo getenv('GOOGLE_STATIC_MAP_API_KEY');
?>