You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

When developing live service but requiring continuous maintenance/development in agile manner, codes needs to be handled by the operation environment (staging/production) - you may able to add development environment by your situation. In that case include_path is super useful.

The methodology I use is including environment file based in PHP like below:

<?php
/* Copyright by Chun Kang (ck@qsok.com)
* 
* @file __env.php
* @brief environments for staging and production \n
* @author Chun Kang (ck@qsok.com)
*
*
* @notes
* 2018.11.13 created
* 
**/

if (! defined(__CK_ENV__)) {
// Basic DB Library ------------------------------------------------------------------------------------------------------

define( '__CK__ENV__', 'RUNTIME_ENVIRONMENT_ESTABLISHED');

date_default_timezone_set('Asia/Seoul');

if (preg_match( "/staging/", getcwd()))
{
define( '__NEWID_BASE_DIR__', '/pub/staging');
define( '__NEWID_DOMAIN_NAME__', 'stg.its-newid.net');
set_include_path( ".:/pub/staging:/pub/staging/_lib");
}
else
{
define( '__NEWID_BASE_DIR__', '/pub/production');
define( '__NEWID_DOMAIN_NAME__', 'its-newid.net');
set_include_path( ".:/pub/production:/pub/production/_lib");

error_reporting(0); // turn off all error reporting
}

$NEWID_BASE_DIR = __NEWID_BASE_DIR__;
$NEWID_DOMAIN_NAME = __NEWID_DOMAIN_NAME__;

// End of Basic DB Library ------------------------------------------------------------------------------------------------------
}

?>


  • No labels