Skip to content
This repository was archived by the owner on Apr 16, 2024. It is now read-only.

Commit e44ce44

Browse files
committed
lucid config file
1 parent 3a98824 commit e44ce44

File tree

2 files changed

+58
-2
lines changed

2 files changed

+58
-2
lines changed

config/lucid.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
return [
4+
/*
5+
|--------------------------------------------------------------------------
6+
| Dashboard
7+
|--------------------------------------------------------------------------
8+
|
9+
| By default /lucid/dashboard is avilable on when env('APP_DEBUG') is true.
10+
| If you set this value to "true" it will be always accessable even on
11+
| production environment.
12+
|
13+
*/
14+
'dashboard' => null,
15+
16+
/*
17+
|--------------------------------------------------------------------------
18+
| Microservice
19+
|--------------------------------------------------------------------------
20+
|
21+
| By default Lucid Architecture is setup as microservice. Microservice
22+
| means that you will have only one service and all features / jobs / data
23+
| etc. will be generated into /app/ directory.
24+
|
25+
| When you set this value to "false" it means you application have multiple
26+
| services and all classes will be generated into /src/ directrory. After
27+
| changing that value all "lucid" classes should be moved from /app/ to
28+
| /src/.
29+
*/
30+
//'microservice' => true,
31+
32+
];

src/LucidServiceProvider.php

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,19 @@ class LucidServiceProvider extends ServiceProvider
2424
*/
2525
public function boot()
2626
{
27-
if (!$this->app->routesAreCached()) {
28-
require_once __DIR__.'/Http/routes.php';
27+
$configPath = __DIR__ . '/../config/lucid.php';
28+
$this->publishes([$configPath => $this->getConfigPath()], 'config');
29+
30+
$dashboard_enabled = $this->app['config']->get('lucid.dashboard');
31+
32+
if ($dashboard_enabled === null) {
33+
$dashboard_enabled = $this->app['config']->get('app.debug');
34+
}
35+
36+
if ($dashboard_enabled === true) {
37+
if (!$this->app->routesAreCached() ) {
38+
require_once __DIR__.'/Http/routes.php';
39+
}
2940
}
3041

3142
$this->loadViewsFrom(__DIR__.'/../resources/views', 'lucid');
@@ -40,6 +51,19 @@ public function boot()
4051
*/
4152
public function register()
4253
{
54+
$configPath = __DIR__ . '/../config/lucid.php';
55+
$this->mergeConfigFrom($configPath, 'lucid');
56+
4357
$this->app->register(LogReaderServiceProvider::class);
4458
}
59+
60+
/**
61+
* Return path to config file.
62+
*
63+
* @return string
64+
*/
65+
private function getConfigPath()
66+
{
67+
return config_path('lucid.php');
68+
}
4569
}

0 commit comments

Comments
 (0)