Allow us to set better default settings. Closes #1755

This commit is contained in:
James Brooks 2016-05-08 16:00:14 +01:00
parent 1584883f39
commit 452eb653a5
2 changed files with 40 additions and 1 deletions

View File

@ -16,6 +16,13 @@ use CachetHQ\Cachet\Models\Setting as SettingModel;
use Exception;
use Illuminate\Support\ServiceProvider;
/**
* This is the config service provider class.
*
* @author James Brooks <james@alt-three.com>
* @author Graham Campbell <graham@alt-three.com>
* @author Joe Cohen <joe@alt-three.com>
*/
class ConfigServiceProvider extends ServiceProvider
{
/**
@ -26,7 +33,16 @@ class ConfigServiceProvider extends ServiceProvider
public function boot()
{
try {
$this->app->config->set('setting', $this->app->setting->all());
// Get the default settings.
$defaultSettings = $this->app->config->get('setting');
// Get the configured settings.
$appSettings = $this->app->setting->all();
// Merge the settings
$settings = array_merge($defaultSettings, $appSettings);
$this->app->config->set('setting', $settings);
} catch (Exception $e) {
//
}

23
config/setting.php Normal file
View File

@ -0,0 +1,23 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return [
/*
|--------------------------------------------------------------------------
| Dashboard Login Link
|--------------------------------------------------------------------------
|
| Whether to show the dashboard link in the footer by default.
|
*/
'dashboard_login_link' => true,
];