protected function bindConfig() { // simple config $config = ['counterparty-sender.connection_string' => env('NATIVE_CONNECTION_STRING', 'http://localhost:8332'), 'counterparty-sender.rpc_user' => env('NATIVE_RPC_USER', null), 'counterparty-sender.rpc_password' => env('NATIVE_RPC_PASSWORD', null)]; // set the laravel config Config::set($config); }
/** * Sets a clean storage driver with configuration & credentials read from environment */ private function refreshDriver() { Config::set('mocked.config.key', array('key' => getenv('AWS_S3_KEY'), 'secret' => getenv('AWS_S3_SECRET'), 'region' => getenv('AWS_S3_REGION'), 's3Bucket' => getenv('AWS_S3_BUCKET'), 's3BucketSubfolder' => getenv('AWS_S3_BUCKET_SUBFOLDER'))); // Inject new file driver and mock config $this->storageDriver = new StorageDriver(); $this->storageDriver->setConfigKey('mocked.config.key'); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @param string $l * @return mixed */ public function handle($request, Closure $next) { //Session::flush(); if (!Session::has('locale')) { /** * Get the browser local code and lang code. */ $localCode = $request->getPreferredLanguage(); $localLang = substr($localCode, 0, 2); if (in_array($localLang, $this->lang)) { Session::set('locale', $localLang); } else { Session::set('locale', Config::get('app.locale')); } } /** * Set the local config. */ App::setLocale(Session::get('locale')); Config::set('app.locale', Session::get('locale')); /** * Share variables in view. */ if (Config::get('app.locale') == 'fr') { View::share(['lang' => 'fr', 'langreverse' => 'en']); } else { View::share(['lang' => 'en', 'langreverse' => 'fr']); } return $next($request); }
/** * Sets up the basic country dependency that gets used all over the app. */ protected function setupCountryDependency() { factory(\Legit\Countries\Country::class)->create(); // Set the testing country tenant identifier. app('Infrastructure\\TenantScope\\TenantScope')->addTenant('country_id', 1); Config::set('country_iso', 'ZA'); }
protected function bindConfig() { // simple config $config = ['insight.connection_string' => env('INSIGHT_CONNECTION_STRING', 'http://localhost:3000')]; // set the laravel config Config::set($config); }
public function handle($payload) { $this->folder = $payload['folder']; $this->cleanUp(); if (isset($payload['bucket'])) { Config::set('S3_BUCKET', $payload['bucket']); } if (isset($payload['region'])) { Config::set('S3_REGION', $payload['region']); } if (isset($payload['secret'])) { Config::set('S3_SECRET', $payload['secret']); } if (isset($payload['key'])) { Config::set('S3_KEY', $payload['key']); } if (isset($payload['destination'])) { $this->thumbnail_destination = $payload['destination']; } else { $this->thumbnail_destination = base_path("storage"); } if (!Storage::exists($this->thumbnail_destination)) { Storage::makeDirectory($this->thumbnail_destination, 0755, true); } $files = Storage::disk('s3')->allFiles($this->folder); Log::info(print_r($files, 1)); $this->getAndMake($files); $this->uploadFilesBacktoS3(); $this->cleanUp(); }
protected function bindConfig() { $prefix = rtrim(env('CONSUL_HEALTH_SERVICE_ID_PREFIX', 'generic'), '_') . '_'; $config = ['consul-health.consul_url' => env('CONSUL_URL', 'http://consul.service.consul:8500'), 'consul-health.health_service_id' => env('CONSUL_HEALTH_SERVICE_ID', $prefix . 'monitor_health'), 'consul-health.loop_delay' => env('CONSUL_LOOP_DELAY', 15), 'consul-health.service_id_prefix' => $prefix]; // set the laravel config Config::set($config); }
protected function bindConfig() { // simple config $config = ['xcpd-client.connection_string' => env('XCPD_CONNECTION_STRING', 'http://localhost:4000'), 'xcpd-client.rpc_user' => env('XCPD_RPC_USER', null), 'xcpd-client.rpc_password' => env('XCPD_RPC_PASSWORD', null)]; // set the laravel config Config::set($config); }
/** * Creates the application. * * @return \Illuminate\Foundation\Application */ public function createApplication() { $app = (require __DIR__ . '/../bootstrap/app.php'); $app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); \Illuminate\Support\Facades\Config::set('fodor.enable_time_estimates', false); return $app; }
/** * Sets a clean storage driver with default substorage path */ private function refreshDriver() { // Inject new file driver and mock config $this->fileStorageDriver = new FileDriver(); $this->fileStorageDriver->setConfigKey('mocked.config.key'); Config::set('mocked.config.key', array('storageSubfolder' => $this->fileStorageFolderRelativeToStoragePath)); }
protected function bindConfig() { // simple config $config = ['bitcoin-address-lib.seed' => env('BITCOIN_MASTER_KEY')]; // set the laravel config Config::set($config); }
public function set($themeName) { if (!Config::get('themes.enabled', true)) { return; } if (!($theme = $this->find($themeName))) { $theme = $this->add(new Theme($themeName)); } $this->activeTheme = $theme; // Build Paths array. // All paths are relative first entry in 'paths' array (set in views.php config file) $paths = []; do { $path = $this->defaultViewsPath[0]; $path .= empty($theme->viewsPath) ? '' : '/' . $theme->viewsPath; if (!in_array($path, $paths)) { $paths[] = $path; } } while ($theme = $theme->getParent()); // fall-back to default paths (set in views.php config file) foreach ($this->defaultViewsPath as $path) { if (!in_array($path, $paths)) { $paths[] = $path; } } Config::set('view.paths', $paths); $themeViewFinder = app('view.finder'); $themeViewFinder->setPaths($paths); }
/** @test */ public function optimized_class_is_created_in_production_environment() { $this->assertFileNotExists(base_path('bootstrap/cache/compiled.php')); Config::set('app.debug', false); Artisan::call('azure:optimize-classes'); $this->assertFileExists(base_path('bootstrap/cache/compiled.php')); }
/** * Recursively merges a file into the boomcms config group. * * @param string $file */ public static function merge($file) { if (file_exists($file)) { $config = c::get('boomcms', []); c::set('boomcms', array_merge_recursive(include $file, $config)); } }
protected function bindConfig() { // simple config $config = ['xcaller-client.queue_connection' => env('XCALLER_QUEUE_CONNECTION', 'blockingbeanstalkd'), 'xcaller-client.queue_name' => env('XCALLER_QUEUE_NAME', 'notifications_out')]; // set the laravel config Config::set($config); }
protected function bindConfig() { // simple config $config = ['xchain.connection_url' => env('XCHAIN_CONNECTION_URL', 'http://xchain.tokenly.co'), 'xchain.api_token' => env('XCHAIN_API_TOKEN', null), 'xchain.api_key' => env('XCHAIN_API_KEY', null)]; // set the laravel config Config::set($config); return $config; }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * * @return mixed */ public function handle(Request $request, Closure $next) { // set curent user preferences to Config if ($user = $request->user()) { Config::set('typicms.user', $user->preferences); } return $next($request); }
protected function bindConfig() { // simple config $config = ['quotebot.connection_url' => env('QUOTEBOT_CONNECTION_URL', 'http://quotebot.tokenly.co'), 'quotebot.api_token' => env('QUOTEBOT_API_TOKEN', null)]; // set the laravel config Config::set($config); return $config; }
/** * Since we are creating test db on the fly, we need switch to the Test DB */ protected function switchDB() { if ($this->isVerbose()) { $this->info(sprintf("Switching to %s ...", $this->test_db_name)); } Config::set('database.connections.' . $this->default_db_type . '.database', $this->test_db_name); DB::reconnect(); }
protected function bindConfig() { // simple config $config = ['xcaller.api_token' => env('XCALLER_API_TOKEN', null), 'xcaller.api_key' => env('XCALLER_API_KEY', null)]; // set the laravel config Config::set($config); return $config; }
protected function bindConfig() { // simple config $server_url = env('PUSHER_SERVER_URL') ?: 'http://pusher.tokenly.co'; $config = ['tokenlyPusher.serverUrl' => $server_url, 'tokenlyPusher.clientUrl' => env('PUSHER_CLIENT_URL', $server_url), 'tokenlyPusher.password' => env('PUSHER_PASSWORD', null)]; // set the laravel config Config::set($config); return $config; }
public function testDbDump() { Config::set('database.connections.sqlite_testing', ['driver' => 'sqlite', 'database' => __DIR__ . '/db/database.sqlite']); $this->artisan('codeception:dbdump', ['connection' => 'sqlite_testing', '--dump' => __DIR__ . '/db/database-dump.sql', '--no-seeding' => true, '--no-interaction' => true]); $this->assertTrue(File::exists(__DIR__ . '/db/database-dump.sql')); $this->assertEquals(strpos(File::get(__DIR__ . '/db/database-dump.sql'), 'BEGIN TRANSACTION;'), 25); $this->assertEquals(strpos(File::get(__DIR__ . '/db/database-dump.sql'), 'CREATE TABLE "users"'), 128); $this->assertEquals(strpos(File::get(__DIR__ . '/db/database-dump.sql'), 'COMMIT;'), 699); }
public function testFileHandleException() { $this->setExpectedException('Ark4ne\\LightQueue\\Exception\\LightQueueException', "FileLockable::__construct: Can't create queue file"); $directory = Config::get('queue.lightqueue.queue_directory'); Config::set('queue.lightqueue.queue_directory', 'Wrong/Directory/Path/'); $fileQueue = new FileQueueProvider('te/feg/hhth/ht/htrt'); $this->setExpectedException(null); $this->assertFalse($fileQueue->push('')); Config::set('queue.lightqueue.queue_directory', $directory); }
/** * Sets the connection's database to the current user database * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { // Get the current authenticated user $user = Auth::user(); // Close any connection made before to avoid conflicts DB::disconnect('tenantdb'); // Set the connection's database to the user's own database Config::set('database.connections.tenantdb.database', storage_path() . '/' . $user->database); return $next($request); }
/** * Register the service provider. * * @return void */ public function register() { $app = $this->app; /* * Register route service provider */ $app->register(\TypiCMS\Modules\Core\Shells\Providers\RouteServiceProvider::class); /* |-------------------------------------------------------------------------- | Init list of modules. |-------------------------------------------------------------------------- */ Config::set('typicms.modules', []); /* |-------------------------------------------------------------------------- | TypiCMS utilities. |-------------------------------------------------------------------------- */ $this->app->singleton('typicms', function () { return new TypiCMS(); }); /* |-------------------------------------------------------------------------- | TypiCMS upload service. |-------------------------------------------------------------------------- */ $this->app->singleton('upload.file', function () { return new FileUpload(); }); /* |-------------------------------------------------------------------------- | Navigation utilities. |-------------------------------------------------------------------------- */ $this->app->singleton('public.navigator', function () { return new PublicNavigator(); }); /* |-------------------------------------------------------------------------- | Sidebar view creator. |-------------------------------------------------------------------------- */ $app->view->creator('core::admin._sidebar', \TypiCMS\Modules\Core\Shells\Composers\SidebarViewCreator::class); /* |-------------------------------------------------------------------------- | View composers. |-------------------------------------------------------------------------- */ $app->view->composers([\TypiCMS\Modules\Core\Shells\Composers\MasterViewComposer::class => '*', \TypiCMS\Modules\Core\Shells\Composers\LocaleComposer::class => '*::public.*', \TypiCMS\Modules\Core\Shells\Composers\LocalesComposer::class => '*::admin.*']); $this->registerCommands(); $this->registerModuleRoutes(); $this->registerCoreModules(); $this->registerTableList(); }
public function installDatabase(array $config) { Config::set('database.connections.mysql.host', $config['db_host']); Config::set('database.connections.mysql.database', $config['db_name']); Config::set('database.connections.mysql.username', $config['db_username']); Config::set('database.connections.mysql.password', $config['db_password']); if (DB::connection()->getDatabaseName()) { $dbenv = "\nDB_HOST={$config['db_host']}\n" . "DB_DATABASE={$config['db_name']}\n" . "DB_PASSWORD={$config['db_password']}\n" . "DB_USERNAME={$config['db_username']}\n"; file_put_contents(__DIR__ . '/../../../../../../.env', $dbenv, FILE_APPEND); } }
/** * Register the service provider. * * @return void */ public function register() { $app = $this->app; /* |-------------------------------------------------------------------------- | Set app locale in front office. |-------------------------------------------------------------------------- */ if (Request::segment(1) != 'admin') { $firstSegment = Request::segment(1); if (in_array($firstSegment, config('translatable.locales'))) { Config::set('app.locale', $firstSegment); } // Not very reliable, need to be refactored setlocale(LC_ALL, config('app.locale') . '_' . strtoupper(config('app.locale')) . '.utf8'); } /* |-------------------------------------------------------------------------- | Init list of modules. |-------------------------------------------------------------------------- */ Config::set('typicms.modules', []); /* |-------------------------------------------------------------------------- | TypiCMS utilities. |-------------------------------------------------------------------------- */ $this->app->singleton('typicms', function (Application $app) { return new TypiCMS(); }); /* |-------------------------------------------------------------------------- | TypiCMS upload service. |-------------------------------------------------------------------------- */ $this->app->singleton('upload.file', function (Application $app) { return new FileUpload(); }); /* |-------------------------------------------------------------------------- | Sidebar view creator. |-------------------------------------------------------------------------- */ $app->view->creator('core::admin._sidebar', 'TypiCMS\\Modules\\Core\\Composers\\SidebarViewCreator'); /* |-------------------------------------------------------------------------- | View composers. |--------------------------------------------------------------------------| */ $app->view->composers(['TypiCMS\\Modules\\Core\\Composers\\MasterViewComposer' => '*', 'TypiCMS\\Modules\\Core\\Composers\\LocaleComposer' => '*::public.*', 'TypiCMS\\Modules\\Core\\Composers\\LocalesComposer' => ['*::*._form']]); $this->registerCommands(); $this->registerModuleRoutes(); $this->registerCoreModules(); }
/** * Define environment setup. * * @param Illuminate\Foundation\Application $app * @return void */ protected function getEnvironmentSetUp($app) { // reset base path to point to our package's src directory $app['path.base'] = __DIR__ . '/../../'; $app['config']->set('app.debug', false); // Here we disable any log output to the console, which makes reading any test // errors/information easier to read and understand during test runs. $monolog = Log::getMonolog(); $monolog->pushHandler(new NullHandler()); // Necessary for future checks Config::set('shift.languages', ['en_GB' => 'English (Great Britain)']); }
public function get($key, $closure) { if (!empty($key) && is_callable($closure)) { $config_key = $this->config_key($key); $data = Config::get($config_key); if (empty($data)) { $data = $closure(); Config::set($config_key, $data); } return $data; } return false; }
/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ public function create(array $data) { $user = User::create(['name' => $data['name'], 'email' => $data['email'], 'database' => $data['name'] . '.sqlite', 'password' => bcrypt($data['password'])]); // Create the new user sqlite database Storage::put($user->database, ''); // Close any connection made with tenantdb DB::disconnect('tenantdb'); // Set the tenant connection to the users own database Config::set('database.connections.tenantdb.database', storage_path() . '/' . $user->database); // Run migrations for the new db Artisan::call('migrate', ['--database' => 'tenantdb', '--path' => 'database/migrations/tenant']); return $user; }