}
if (!defined('APPLICATION_ENV')) {
    if ($environment = getenv('environment')) {
        define('APPLICATION_ENV', $environment);
    } else {
        define('APPLICATION_ENV', 'development');
    }
}
if ($enablerespositories) {
    $repositoriespath = APPLICATION_PATH . '/config/repositories.php';
    if (is_file($repositoriespath)) {
        $repositories = (require $repositoriespath);
    } else {
        $repositories = array('application' => APPLICATION_PATH);
    }
    $packagenamespaces = (require APPLICATION_PATH . '/config/packagenamespaces.php');
} else {
    $repositories = false;
    $packagenamespaces = (require DRAGONJSONSERVER_PATH . '/config/packagenamespaces.php');
}
if (!($zendpath = getenv('zendpath'))) {
    $zendpath = DRAGONJSONSERVER_PATH . '/../library';
}
require DRAGONJSONSERVER_PATH . '/library/Dragon/Application/Application.php';
$application = new Dragon_Application_Application();
$application->setEnvironment(APPLICATION_ENV)->setTimezone()->addLibrarypaths(array($zendpath, DRAGONJSONSERVER_PATH . '/library'))->initAutoloader()->initRegistry()->initPackageRegistry($packagenamespaces);
if ($repositories) {
    $application->initRepositoryRegistry($repositories);
}
$application->initPluginRegistry()->bootstrap();