Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
timacdonald committed Aug 15, 2023
1 parent f23157b commit b1f62f2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
8 changes: 5 additions & 3 deletions config/pulse.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,22 @@
'storage' => [
'driver' => env('PULSE_STORAGE_DRIVER', 'database'),

'retain' => Interval::days(7),

'database' => [
'connection' => env('PULSE_DB_CONNECTION') ?? env('DB_CONNECTION') ?? 'mysql',
'retain' => Interval::days(7),
],
],

'ingest' => [
'driver' => env('PULSE_INGEST_DRIVER', 'storage'),
'driver' => env('PULSE_INGEST_DRIVER', 'redis'),

'retain' => Interval::days(7),

'lottery' => [1, 100],

'redis' => [
'connection' => env('PULSE_REDIS_CONNECTION') ?? 'default',
'retain' => Interval::days(7),
],
],

Expand Down
11 changes: 9 additions & 2 deletions src/PulseServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Illuminate\Queue\Events\JobProcessed;
use Illuminate\Queue\Events\JobProcessing;
use Illuminate\Queue\Events\JobQueued;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Event;
Expand Down Expand Up @@ -65,7 +66,10 @@ public function register(): void
$this->app->singleton(Storage::class, function ($app) {
$driver = Config::get('pulse.storage.driver');

$config = Config::get("pulse.storage.{$driver}");
$config = [
...Arr::only(Config::get('pulse.storage'), ['retain']),
...Config::get("pulse.storage.{$driver}"),
];

return new Database($config, $app['db']);
});
Expand All @@ -77,7 +81,10 @@ public function register(): void
return $app[StorageIngest::class];
}

$ingestConfig = Config::get("pulse.ingest.{$driver}");
$ingestConfig = [
...Arr::only(Config::get('pulse.ingest'), ['retain', 'lottery']),
...Config::get("pulse.ingest.{$driver}"),
];

$redisConfig = [
...Config::get('database.redis.options'),
Expand Down

0 comments on commit b1f62f2

Please sign in to comment.