Skip to content

Commit 2235daa

Browse files
authored
Merge pull request #334 from armanist/333-Rename-config.php-to-app.php-and-move-2FA-configs
Rename `config.php` to `app.php` and move 2FA configs
2 parents aca72ef + 5a8712d commit 2235daa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+238
-235
lines changed

src/App/Adapters/ConsoleAppAdapter.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @author Arman Ag. <arman.ag@softberg.org>
1010
* @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
1111
* @link http://quantum.softberg.org/
12-
* @since 2.9.7
12+
* @since 2.9.9
1313
*/
1414

1515
namespace Quantum\App\Adapters;
@@ -64,7 +64,7 @@ public function __construct()
6464

6565
if ($commandName !== 'core:env') {
6666
$this->loadEnvironment();
67-
$this->loadConfig();
67+
$this->loadAppConfig();
6868
}
6969
}
7070

@@ -81,8 +81,8 @@ public function start(): ?int
8181
{
8282
try {
8383
$this->application = $this->createApplication(
84-
config()->get('app_name', 'UNKNOWN'),
85-
config()->get('app_version', 'UNKNOWN')
84+
config()->get('app.name', 'UNKNOWN'),
85+
config()->get('app.version', 'UNKNOWN')
8686
);
8787

8888
$this->registerCoreCommands();

src/App/Adapters/WebAppAdapter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @author Arman Ag. <arman.ag@softberg.org>
1010
* @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
1111
* @link http://quantum.softberg.org/
12-
* @since 2.9.8
12+
* @since 2.9.9
1313
*/
1414

1515
namespace Quantum\App\Adapters;
@@ -69,7 +69,7 @@ public function __construct()
6969
parent::__construct();
7070

7171
$this->loadEnvironment();
72-
$this->loadConfig();
72+
$this->loadAppConfig();
7373

7474
$this->request = Di::get(Request::class);
7575
$this->response = Di::get(Response::class);

src/App/Helpers/misc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @author Arman Ag. <arman.ag@softberg.org>
1010
* @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
1111
* @link http://quantum.softberg.org/
12-
* @since 2.9.7
12+
* @since 2.9.9
1313
*/
1414

1515
use Symfony\Component\VarExporter\Exception\ExceptionInterface;
@@ -88,7 +88,7 @@ function slugify(string $text): string
8888
*/
8989
function is_debug_mode(): bool
9090
{
91-
return filter_var(config()->get('debug'), FILTER_VALIDATE_BOOLEAN);
91+
return filter_var(config()->get('app.debug'), FILTER_VALIDATE_BOOLEAN);
9292
}
9393

9494
/**

src/App/Traits/AppTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ protected function loadEnvironment()
143143
* @throws ReflectionException
144144
* @throws ConfigException
145145
*/
146-
protected function loadConfig()
146+
protected function loadAppConfig()
147147
{
148-
Config::getInstance()->load(new Setup('config', 'config'));
148+
Config::getInstance()->import(new Setup('config', 'app'));
149149
}
150150

151151
/**

src/Debugger/Debugger.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @author Arman Ag. <arman.ag@softberg.org>
1010
* @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
1111
* @link http://quantum.softberg.org/
12-
* @since 2.9.5
12+
* @since 2.9.9
1313
*/
1414

1515
namespace Quantum\Debugger;
@@ -128,7 +128,7 @@ public static function getInstance(DebuggerStore $store = null, DebugBar $debugB
128128
*/
129129
public function isEnabled(): bool
130130
{
131-
return filter_var(config()->get('debug'), FILTER_VALIDATE_BOOLEAN);
131+
return filter_var(config()->get('app.debug'), FILTER_VALIDATE_BOOLEAN);
132132
}
133133

134134
/**

src/Http/Request/HttpRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @author Arman Ag. <arman.ag@softberg.org>
1010
* @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
1111
* @link http://quantum.softberg.org/
12-
* @since 2.9.8
12+
* @since 2.9.9
1313
*/
1414

1515
namespace Quantum\Http\Request;
@@ -210,7 +210,7 @@ public static function getCsrfToken(): ?string
210210
*/
211211
public static function getBaseUrl(bool $withModulePrefix = false): string
212212
{
213-
$baseUrl = config()->get('base_url');
213+
$baseUrl = config()->get('app.base_url');
214214

215215
$prefix = route_prefix();
216216
$modulePrefix = ($withModulePrefix && !empty($prefix)) ? '/' . $prefix : '';

src/Libraries/Auth/Traits/AuthTrait.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @author Arman Ag. <arman.ag@softberg.org>
1010
* @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
1111
* @link http://quantum.softberg.org/
12-
* @since 2.9.7
12+
* @since 2.9.9
1313
*/
1414

1515
namespace Quantum\Libraries\Auth\Traits;
@@ -249,7 +249,7 @@ protected function twoStepVerification(User $user): string
249249

250250
$time = new DateTime();
251251

252-
$time->add(new DateInterval('PT' . config()->get('otp_expires') . 'M'));
252+
$time->add(new DateInterval('PT' . config()->get('auth.otp_expires') . 'M'));
253253

254254
$this->authService->update(
255255
$this->keyFields[AuthKeys::USERNAME],
@@ -344,7 +344,7 @@ protected function isActivated(User $user): bool
344344
*/
345345
protected function generateToken(string $val = null): string
346346
{
347-
return base64_encode($this->hasher->hash($val ?: config()->get('app_key')));
347+
return base64_encode($this->hasher->hash($val ?: config()->get('app.key')));
348348
}
349349

350350
/**
@@ -356,8 +356,8 @@ protected function sendMail(User $user, array $body)
356356
{
357357
$fullName = ($user->hasField('firstname') && $user->hasField('lastname')) ? $user->getFieldValue('firstname') . ' ' . $user->getFieldValue('lastname') : '';
358358

359-
$appEmail = config()->get('app_email') ?: '';
360-
$appName = config()->get('app_name') ?: '';
359+
$appEmail = config()->get('app.email') ?: '';
360+
$appName = config()->get('app.name') ?: '';
361361

362362
$this->mailer->setFrom($appEmail, $appName)
363363
->setAddress($user->getFieldValue($this->keyFields[AuthKeys::USERNAME]), $fullName)
@@ -394,6 +394,6 @@ protected function verifySchema(array $schema)
394394
*/
395395
protected function isTwoFactorEnabled(): bool
396396
{
397-
return filter_var(config()->get('TWO_FA'), FILTER_VALIDATE_BOOLEAN);
397+
return filter_var(config()->get('auth.two_fa'), FILTER_VALIDATE_BOOLEAN);
398398
}
399399
}

src/Libraries/Database/Adapters/Idiorm/IdiormDbal.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @author Arman Ag. <arman.ag@softberg.org>
1010
* @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
1111
* @link http://quantum.softberg.org/
12-
* @since 2.9.8
12+
* @since 2.9.9
1313
*/
1414

1515
namespace Quantum\Libraries\Database\Adapters\Idiorm;
@@ -252,7 +252,7 @@ protected static function getBaseConfig(string $driver, array $config): array
252252
{
253253
return [
254254
'connection_string' => self::buildConnectionString($driver, $config),
255-
'logging' => config()->get('debug', false),
255+
'logging' => config()->get('app.debug', false),
256256
'error_mode' => PDO::ERRMODE_EXCEPTION,
257257
];
258258
}

src/Libraries/Encryption/Adapters/SymmetricEncryptionAdapter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @author Arman Ag. <arman.ag@softberg.org>
1010
* @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
1111
* @link http://quantum.softberg.org/
12-
* @since 2.9.7
12+
* @since 2.9.9
1313
*/
1414

1515
namespace Quantum\Libraries\Encryption\Adapters;
@@ -41,7 +41,7 @@ class SymmetricEncryptionAdapter implements EncryptionInterface
4141
*/
4242
public function __construct()
4343
{
44-
$appKey = config()->get('app_key');
44+
$appKey = config()->get('app.key');
4545

4646
if (!$appKey) {
4747
throw AppException::missingAppKey();

src/Module/Templates/DefaultWeb/src/Controllers/MainController.php.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @author Arman Ag. <arman.ag@softberg.org>
1010
* @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
1111
* @link http://quantum.softberg.org/
12-
* @since 2.9.8
12+
* @since 2.9.9
1313
*/
1414

1515
namespace {{MODULE_NAMESPACE}}\Controllers;
@@ -51,7 +51,7 @@ class MainController extends RouteController
5151
public function index(Response $response, ViewFactory $view)
5252
{
5353
$view->setParams([
54-
'title' => config()->get('app_name'),
54+
'title' => config()->get('app.name'),
5555
]);
5656
5757
$response->html($view->render('index'));

0 commit comments

Comments
 (0)