34 lines
891 B
PHP
34 lines
891 B
PHP
<?php
|
|
|
|
use Igorw\Silex\ConfigServiceProvider;
|
|
use Silex\Application;
|
|
|
|
function boot_load() {
|
|
// Enable Composer autoloading.
|
|
require_once __DIR__ . '/../vendor/autoload.php';
|
|
|
|
// Hard load non-autoloadable Google library
|
|
$lib_path = realpath(__DIR__ . '/../lib/google-api-php-client');
|
|
|
|
require_once "$lib_path/src/Google_Client.php";
|
|
require_once "$lib_path/src/contrib/Google_CalendarService.php";
|
|
}
|
|
|
|
function boot_app($env = 'prod') {
|
|
$config_dir = realpath(__DIR__ . '/../config');
|
|
|
|
$base_config = "$config_dir/config.json";
|
|
$env_config = "$config_dir/$env.json";
|
|
|
|
$app = new Application();
|
|
$app->register(new ConfigServiceProvider($base_config));
|
|
$app->register(new ConfigServiceProvider($env_config));
|
|
return $app;
|
|
}
|
|
|
|
function boot() {
|
|
$env = isset($_ENV['APP_ENV']) ? $_ENV['APP_ENV'] : 'prod';
|
|
boot_load($env);
|
|
$app = boot_app($env);
|
|
return $app;
|
|
}
|