Skip to content

Commit

Permalink
merge default backup config with user config
Browse files Browse the repository at this point in the history
  • Loading branch information
mho22 committed Dec 31, 2024
1 parent b2e779d commit 6358d30
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Config/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ public static function rebind(): void
/** @param array<mixed> $data */
public static function fromArray(array $data): self
{
$source = require realpath(__DIR__.'/../../config/backup.php');

return new self(
backup: BackupConfig::fromArray($data['backup']),
notifications: NotificationsConfig::fromArray($data['notifications']),
monitoredBackups: MonitoredBackupsConfig::fromArray($data['monitor_backups']),
cleanup: CleanupConfig::fromArray($data['cleanup']),
backup: BackupConfig::fromArray(array_merge($source['backup'], $data['backup'])),
notifications: NotificationsConfig::fromArray(array_merge($source['notifications'], $data['notifications'])),
monitoredBackups: MonitoredBackupsConfig::fromArray($data['monitor_backups'] ?? $source['notifications']),
cleanup: CleanupConfig::fromArray(array_merge($source['cleanup'], $data['cleanup']))
);
}
}

0 comments on commit 6358d30

Please sign in to comment.