Skip to content

Commit 58189c4

Browse files
committed
Change Notification to not notify PubSup if none is configured.
1 parent 650db87 commit 58189c4

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

solid/lib/Controller/SolidWebsocketController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ class SolidWebsocketController extends Controller
1414
*/
1515
public function register(): DataResponse
1616
{
17+
// @FIXME: If there is no PUBSUB_URL what should be returned? 404? 500? Yo'mamma? 2023/01/27/BMP
1718
$pubsub = getenv("PUBSUB_URL") ?: "http://pubsub:8080";
19+
1820
return new DataResponse([
1921
"@context" => "https://www.w3.org/ns/solid/notification/v1",
2022
"type" => "WebSocketSubscription2021",

solid/lib/Notifications/SolidNotifications.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,18 @@ class SolidNotifications implements SolidNotificationsInterface
99
{
1010
private $notifications;
1111
public function __construct() {
12-
$pubsub = getenv("PUBSUB_URL") ?: "http://pubsub:8080";
13-
$this->notifications = [
14-
new SolidWebhook(),
15-
new SolidPubSub($pubsub)
16-
];
12+
13+
$notifications = [
14+
new SolidWebhook(),
15+
];
16+
17+
$pubsub = getenv('PUBSUB_URL');
18+
19+
if ($pubsub) {
20+
$notifications[] = new SolidPubSub($pubsub);
21+
}
22+
23+
$this->notifications = $notifications;
1724
}
1825

1926
public function send($path, $type) {

0 commit comments

Comments
 (0)