public function register(Application $app)
 {
     $app['config.server'] = $app->share(function () use($app) {
         if ($app['debug']) {
             $config = new ConfigServer(new MongoStorage('ConfigServer', 'config', 'localhost'));
         } else {
             $config = ConfigServer::createDefault();
         }
         $config->setCache(new Cache($app['memcache']));
         return $config;
     });
 }
Example #2
0
 public function testCache()
 {
     $storage = new MongoStorage('ConfigServer_test', 'config', 'localhost');
     $config = new ConfigServer($storage);
     $config->setCache(new Cache(new NullableMemcache()));
     $config->set('key', 'value');
     $config->set('key:2', 'value:2');
     $this->assertEquals('value', $config->get('key'));
     $storage->collection()->drop();
     $this->assertEquals('value', $config->get('key'));
     $this->assertEquals('value:2', $config->get('key:2'));
 }
 public function testCreateDefault()
 {
     $this->assertInstanceOf(ConfigServer::class, ConfigServer::createDefault());
 }