use werx\Config\Providers\ArrayProvider;
use werx\Config\Container;
/* ------------------------------------------------------------------------------------------------
 * Slim Application Initialization
 * -----------------------------------------------------------------------------------------------*/
$app = new Slim(array('log.enabled' => true));
/* ------------------------------------------------------------------------------------------------
 * Configuration
 * -----------------------------------------------------------------------------------------------*/
$provider = new ArrayProvider('../config');
$config = new Container($provider);
// Environment Selection
$app->configureMode('development', function () use($config) {
    $config->setEnvironment('development');
});
$config->load(array('opentok'), true);
// Constants
define('NAME_MAX_LENGTH', '100');
/* ------------------------------------------------------------------------------------------------
 * OpenTok Initialization
 * -----------------------------------------------------------------------------------------------*/
$opentok = new OpenTok($config->opentok('key'), $config->opentok('secret'));
/* ------------------------------------------------------------------------------------------------
 * Routing
 * -----------------------------------------------------------------------------------------------*/
// Presence configuration
//
// Response: (JSON encoded)
// *  `apiKey`: The presence session API Key
// *  `sessionId`: The presence session ID
$app->get('/presence', function () use($app, $config) {
Exemple #2
0
 public function testCanUseCallableNotSingleton()
 {
     $this->config->load('callable');
     $bar = $this->config->get('bar2');
     $this->assertTrue($bar !== $this->config->get('bar2'));
 }
Exemple #3
0
use werx\Config\Container;
use Predis\Response\ErrorInterface as RedisErrorInterface;
/* ------------------------------------------------------------------------------------------------
 * Slim Application Initialization
 * -----------------------------------------------------------------------------------------------*/
$app = new Slim(array('log.enabled' => true, 'templates.path' => '../templates'));
/* ------------------------------------------------------------------------------------------------
 * Configuration
 * -----------------------------------------------------------------------------------------------*/
$provider = new ArrayProvider('../config');
$config = new Container($provider);
// Environment Selection
$app->configureMode('development', function () use($config) {
    $config->setEnvironment('development');
});
$config->load(array('opentok', 'redis'), true);
/* ------------------------------------------------------------------------------------------------
 * OpenTok Initialization
 * -----------------------------------------------------------------------------------------------*/
$opentok = new OpenTok($config->opentok('key'), $config->opentok('secret'));
/* ------------------------------------------------------------------------------------------------
 * Redis Initialization
 * -----------------------------------------------------------------------------------------------*/
$redis = new \Predis\Client($config->redis(), array('prefix' => $config->redis('prefix')));
define('PREFIX_HELP_SESSION_KEY', 'helpsession:');
define('HELP_QUEUE_KEY', 'helpqueue');
/* ------------------------------------------------------------------------------------------------
 * Routing
 * -----------------------------------------------------------------------------------------------*/
// Customer landing page
$app->get('/', function () use($app) {
Exemple #4
0
use werx\Config\Container;
use OpenTok\Role;
/* ------------------------------------------------------------------------------------------------
 * Slim Application Initialization
 * -----------------------------------------------------------------------------------------------*/
$app = new Slim(array('log.enabled' => true, 'templates.path' => '../templates'));
/* ------------------------------------------------------------------------------------------------
 * Configuration
 * -----------------------------------------------------------------------------------------------*/
$provider = new ArrayProvider('../config');
$config = new Container($provider);
// Environment Selection
$app->configureMode('development', function () use($config) {
    $config->setEnvironment('development');
});
$config->load(array('opentok', 'mysql'), true);
/* ------------------------------------------------------------------------------------------------
 * OpenTok Initialization
 * -----------------------------------------------------------------------------------------------*/
$opentok = new OpenTok($config->opentok('key'), $config->opentok('secret'));
/* ------------------------------------------------------------------------------------------------
 * Setup MySQL
 * -----------------------------------------------------------------------------------------------*/
// mysql - replace user/pw and database name
// Set env vars in /Applications/MAMP/Library/bin/envvars if you are using MAMP
// MYSQL env: export CLEARDB_DATABASE_URL="mysql://root:root@localhost/adserverkit
// MYSQL formate: username:pw@url/database
$mysql_url = parse_url(getenv("CLEARDB_DATABASE_URL") ?: $config->mysql('mysql_url'));
$dbname = substr($mysql_url['path'], 1);
$host = $mysql_url['host'];
if ($mysql_url['port']) {