添加部署配置环境的判断

deploy
a74589669 2019-09-17 00:09:38 +08:00
parent d7dbac6868
commit e2c31c714f
2 changed files with 8 additions and 1 deletions

View File

@ -2,6 +2,8 @@
namespace App;
/**
* Application configuration
*
@ -19,6 +21,7 @@ class Config
* @var string
*/
const DB_NAME = 'background';
const ROUTE_PREFIX_DEV = "/api/public/";
const ROUTE_PREFIX = "/wapi/";
/**
* Database user
@ -36,3 +39,4 @@ class Config
*/
const SHOW_ERRORS = true;
}

View File

@ -23,8 +23,11 @@ $router = new Core\Router();
$router->add('', ['controller' => 'Home', 'action' => 'index']);
$router->add('{controller}/{action}');
$router->add('{controller}/{action}/{id:.+}');
if($_SERVER['HTTP_HOST'] == '127.0.0.1')
$router->AddPrefix(\App\Config::ROUTE_PREFIX_DEV);
else
$router->AddPrefix(\App\Config::ROUTE_PREFIX);
$router->AddPrefix(\App\Config::ROUTE_PREFIX);
try{
//for prefight request
if($_SERVER['REQUEST_METHOD'] == 'OPTIONS'){