Skip to content

Commit 0efd0e0

Browse files
committed
feat(config): Add new notification channels
- Added new notification channels for various platforms such as Bark, Chanify, DingTalk, Discord, Lark, Ntfy, QQ, Slack, Telegram, WeWork, and Zulip - Each channel includes driver configuration, authenticator details, client setup, message structure, and pipes for message processing - Integrated with the Guanguans Notify package for seamless notification handling
1 parent fc49f18 commit 0efd0e0

File tree

1 file changed

+242
-20
lines changed

1 file changed

+242
-20
lines changed

config/exception-notify.php

+242-20
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Guanguans\LaravelExceptionNotify\Pipes\FixPrettyJsonPipe;
1616
use Guanguans\LaravelExceptionNotify\Pipes\LimitLengthPipe;
1717
use Guanguans\LaravelExceptionNotify\Pipes\SprintfHtmlPipe;
18+
use Guanguans\LaravelExceptionNotify\Pipes\SprintfMarkdownPipe;
1819
use Guanguans\LaravelExceptionNotify\ReportUsingCreator;
1920

2021
return [
@@ -79,11 +80,11 @@
7980
Guanguans\LaravelExceptionNotify\Collectors\ExceptionContextCollector::class,
8081
Guanguans\LaravelExceptionNotify\Collectors\ExceptionTraceCollector::class,
8182
Guanguans\LaravelExceptionNotify\Collectors\RequestBasicCollector::class,
82-
Guanguans\LaravelExceptionNotify\Collectors\RequestHeaderCollector::class,
83-
Guanguans\LaravelExceptionNotify\Collectors\RequestQueryCollector::class,
84-
Guanguans\LaravelExceptionNotify\Collectors\RequestPostCollector::class,
85-
Guanguans\LaravelExceptionNotify\Collectors\RequestRawFileCollector::class,
86-
Guanguans\LaravelExceptionNotify\Collectors\RequestFileCollector::class,
83+
// Guanguans\LaravelExceptionNotify\Collectors\RequestHeaderCollector::class,
84+
// Guanguans\LaravelExceptionNotify\Collectors\RequestQueryCollector::class,
85+
// Guanguans\LaravelExceptionNotify\Collectors\RequestPostCollector::class,
86+
// Guanguans\LaravelExceptionNotify\Collectors\RequestRawFileCollector::class,
87+
// Guanguans\LaravelExceptionNotify\Collectors\RequestFileCollector::class,
8788
// \Guanguans\LaravelExceptionNotify\Collectors\RequestMiddlewareCollector::class,
8889
// \Guanguans\LaravelExceptionNotify\Collectors\RequestServerCollector::class,
8990
// \Guanguans\LaravelExceptionNotify\Collectors\RequestCookieCollector::class,
@@ -101,15 +102,151 @@
101102
* The list of channels.
102103
*/
103104
'channels' => [
105+
/**
106+
* Log.
107+
*
108+
* @see \Illuminate\Support\Facades\Log
109+
* @see \Illuminate\Log\LogManager
110+
*/
111+
'log' => [
112+
'driver' => 'log',
113+
'channel' => 'daily',
114+
],
115+
116+
/**
117+
* Mail.
118+
*
119+
* @see \Illuminate\Support\Facades\Mail
120+
* @see \Illuminate\Mail\MailManager
121+
*/
122+
'mail' => [
123+
'mailer' => null,
124+
'to' => env('EXCEPTION_NOTIFY_MAIL_TO', '[email protected]'),
125+
'pipes' => [
126+
SprintfHtmlPipe::class,
127+
],
128+
],
129+
130+
/**
131+
* Bark.
132+
*
133+
* @see https://github.com/guanguans/notify#platform-support
134+
*/
135+
'bark' => [
136+
'driver' => 'notify',
137+
'authenticator' => [
138+
'class' => \Guanguans\Notify\Bark\Authenticator::class,
139+
'token' => env('EXCEPTION_NOTIFY_BARK_TOKEN'),
140+
],
141+
'client' => [
142+
'class' => \Guanguans\Notify\Bark\Client::class,
143+
'http_options' => [],
144+
// 'tapper' => \Guanguans\LaravelExceptionNotify\DefaultClientTapper::class,
145+
],
146+
'message' => [
147+
'class' => \Guanguans\Notify\Bark\Messages\Message::class,
148+
'title' => '{title}',
149+
'body' => '{report}',
150+
],
151+
'pipes' => [
152+
FixPrettyJsonPipe::class,
153+
hydrate_pipe(LimitLengthPipe::class, 1024),
154+
],
155+
],
156+
157+
/**
158+
* Chanify.
159+
*
160+
* @see https://github.com/guanguans/notify#platform-support
161+
*/
162+
'chanify' => [
163+
'driver' => 'notify',
164+
'authenticator' => [
165+
'class' => \Guanguans\Notify\Chanify\Authenticator::class,
166+
'token' => env('EXCEPTION_NOTIFY_CHANIFY_TOKEN'),
167+
],
168+
'client' => [
169+
'class' => \Guanguans\Notify\Chanify\Client::class,
170+
'http_options' => [],
171+
// 'tapper' => \Guanguans\LaravelExceptionNotify\DefaultClientTapper::class,
172+
],
173+
'message' => [
174+
'class' => \Guanguans\Notify\Chanify\Messages\TextMessage::class,
175+
'title' => '{title}',
176+
'text' => '{report}',
177+
],
178+
'pipes' => [
179+
FixPrettyJsonPipe::class,
180+
hydrate_pipe(LimitLengthPipe::class, 1024),
181+
],
182+
],
183+
184+
/**
185+
* DingTalk.
186+
*
187+
* @see https://github.com/guanguans/notify#platform-support
188+
*/
189+
'dingTalk' => [
190+
'driver' => 'notify',
191+
'authenticator' => [
192+
'class' => \Guanguans\Notify\DingTalk\Authenticator::class,
193+
'token' => env('EXCEPTION_NOTIFY_DINGTALK_TOKEN'),
194+
'secret' => env('EXCEPTION_NOTIFY_DINGTALK_SECRET'),
195+
],
196+
'client' => [
197+
'class' => \Guanguans\Notify\DingTalk\Client::class,
198+
'http_options' => [],
199+
// 'tapper' => \Guanguans\LaravelExceptionNotify\DefaultClientTapper::class,
200+
],
201+
'message' => [
202+
'class' => \Guanguans\Notify\DingTalk\Messages\MarkdownMessage::class,
203+
'title' => '{title}',
204+
'text' => '{report}',
205+
],
206+
'pipes' => [
207+
hydrate_pipe(AddKeywordPipe::class, env('EXCEPTION_NOTIFY_DINGTALK_KEYWORD')),
208+
FixPrettyJsonPipe::class,
209+
hydrate_pipe(LimitLengthPipe::class, 20000),
210+
],
211+
],
212+
213+
/**
214+
* Discord.
215+
*
216+
* @see https://github.com/guanguans/notify#platform-support
217+
*/
218+
'discord' => [
219+
'driver' => 'notify',
220+
'authenticator' => [
221+
'class' => \Guanguans\Notify\Discord\Authenticator::class,
222+
'webHook' => env('EXCEPTION_NOTIFY_DISCORD_WEBHOOK'),
223+
],
224+
'client' => [
225+
'class' => \Guanguans\Notify\Discord\Client::class,
226+
'http_options' => [],
227+
// 'tapper' => \Guanguans\LaravelExceptionNotify\DefaultClientTapper::class,
228+
],
229+
'message' => [
230+
'class' => \Guanguans\Notify\Discord\Messages\Message::class,
231+
'content' => '{report}',
232+
],
233+
'pipes' => [
234+
FixPrettyJsonPipe::class,
235+
hydrate_pipe(LimitLengthPipe::class, 2000),
236+
],
237+
],
238+
104239
/**
105240
* Lark.
241+
*
242+
* @see https://github.com/guanguans/notify#platform-support
106243
*/
107244
'lark' => [
108245
'driver' => 'notify',
109246
'authenticator' => [
110247
'class' => \Guanguans\Notify\Lark\Authenticator::class,
111-
'token' => '...',
112-
'secret' => '...',
248+
'token' => env('EXCEPTION_NOTIFY_LARK_TOKEN'),
249+
'secret' => env('EXCEPTION_NOTIFY_LARK_SECRET'),
113250
],
114251
'client' => [
115252
'class' => \Guanguans\Notify\Lark\Client::class,
@@ -121,34 +258,119 @@
121258
'text' => '{report}',
122259
],
123260
'pipes' => [
124-
hydrate_pipe(AddKeywordPipe::class, 'keyword'),
261+
hydrate_pipe(AddKeywordPipe::class, env('EXCEPTION_NOTIFY_LARK_KEYWORD')),
125262
FixPrettyJsonPipe::class,
126263
hydrate_pipe(LimitLengthPipe::class, 30720),
127264
],
128265
],
129266

130267
/**
131-
* Mail.
268+
* Ntfy.
132269
*
133-
* @see Illuminate\Mail\MailManager
270+
* @see https://github.com/guanguans/notify#platform-support
134271
*/
135-
'mail' => [
136-
'mailer' => null,
137-
'to' => '[email protected]',
272+
'ntfy' => [
273+
'driver' => 'notify',
274+
'authenticator' => [
275+
'class' => \Guanguans\Notify\Ntfy\Authenticator::class,
276+
'usernameOrToken' => env('EXCEPTION_NOTIFY_NTFY_USERNAMEORTOKEN'),
277+
'password' => env('EXCEPTION_NOTIFY_NTFY_PASSWORD'),
278+
],
279+
'client' => [
280+
'class' => \Guanguans\Notify\Ntfy\Client::class,
281+
'http_options' => [],
282+
// 'tapper' => \Guanguans\LaravelExceptionNotify\DefaultClientTapper::class,
283+
],
284+
'message' => [
285+
'class' => \Guanguans\Notify\Ntfy\Messages\Message::class,
286+
'topic' => env('EXCEPTION_NOTIFY_NTFY_TOPIC', 'laravel-exception-notify'),
287+
'title' => '{title}',
288+
'message' => '{report}',
289+
],
138290
'pipes' => [
139-
SprintfHtmlPipe::class,
291+
// FixPrettyJsonPipe::class,
292+
// hydrate_pipe(LimitLengthPipe::class, 30720),
140293
],
141294
],
142295

143296
/**
144-
* Log.
297+
* Slack.
145298
*
146-
* @see Illuminate\Log\LogManager
299+
* @see https://github.com/guanguans/notify#platform-support
147300
*/
148-
'log' => [
149-
'driver' => 'log',
150-
'channel' => 'daily',
151-
'pipes' => [],
301+
'slack' => [
302+
'driver' => 'notify',
303+
'authenticator' => [
304+
'class' => \Guanguans\Notify\Slack\Authenticator::class,
305+
'webHook' => env('EXCEPTION_NOTIFY_SLACK_WEBHOOK'),
306+
],
307+
'client' => [
308+
'class' => \Guanguans\Notify\Slack\Client::class,
309+
'http_options' => [],
310+
// 'tapper' => \Guanguans\LaravelExceptionNotify\DefaultClientTapper::class,
311+
],
312+
'message' => [
313+
'class' => \Guanguans\Notify\Slack\Messages\Message::class,
314+
'text' => '{report}',
315+
],
316+
'pipes' => [
317+
SprintfMarkdownPipe::class,
318+
// FixPrettyJsonPipe::class,
319+
// hydrate_pipe(LimitLengthPipe::class, 30720),
320+
],
321+
],
322+
323+
/**
324+
* Telegram.
325+
*
326+
* @see https://github.com/guanguans/notify#platform-support
327+
*/
328+
'telegram' => [
329+
'driver' => 'notify',
330+
'authenticator' => [
331+
'class' => \Guanguans\Notify\Telegram\Authenticator::class,
332+
'token' => env('EXCEPTION_NOTIFY_TELEGRAM_TOKEN'),
333+
],
334+
'client' => [
335+
'class' => \Guanguans\Notify\Telegram\Client::class,
336+
'http_options' => [],
337+
// 'tapper' => \Guanguans\LaravelExceptionNotify\DefaultClientTapper::class,
338+
],
339+
'message' => [
340+
'class' => \Guanguans\Notify\Telegram\Messages\TextMessage::class,
341+
'chat_id' => env('EXCEPTION_NOTIFY_TELEGRAM_CHAT_ID'),
342+
'text' => '{report}',
343+
],
344+
'pipes' => [
345+
FixPrettyJsonPipe::class,
346+
hydrate_pipe(LimitLengthPipe::class, 4096),
347+
],
348+
],
349+
350+
/**
351+
* WeWork.
352+
*
353+
* @see https://github.com/guanguans/notify#platform-support
354+
*/
355+
'weWork' => [
356+
'driver' => 'notify',
357+
'authenticator' => [
358+
'class' => \Guanguans\Notify\WeWork\Authenticator::class,
359+
'token' => env('EXCEPTION_NOTIFY_WEWORK_TOKEN'),
360+
],
361+
'client' => [
362+
'class' => \Guanguans\Notify\WeWork\Client::class,
363+
'http_options' => [],
364+
// 'tapper' => \Guanguans\LaravelExceptionNotify\DefaultClientTapper::class,
365+
],
366+
'message' => [
367+
'class' => \Guanguans\Notify\WeWork\Messages\MarkdownMessage::class,
368+
'content' => '{report}',
369+
],
370+
'pipes' => [
371+
FixPrettyJsonPipe::class,
372+
hydrate_pipe(LimitLengthPipe::class, 5120),
373+
],
152374
],
153375
],
154376
];

0 commit comments

Comments
 (0)