Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/update provider #14

Merged
merged 8 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 52 additions & 9 deletions config/telegram-git-notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,81 @@

return [
'app' => [
'name' => env('APP_NAME', 'Laravel Telegram Git Notify'),
'url' => env('APP_URL', 'http://localhost:8000'),
'name' => env('TGN_APP_NAME', 'Laravel Telegram Git Notifier'),

// Required for the bot to work properly
'url' => env('TGN_APP_URL', 'http://localhost:8000'),
'timezone' => env('TIMEZONE', 'Asia/Ho_Chi_Minh'),
],

'bot' => [
'token' => env('TELEGRAM_BOT_TOKEN', ''),
'chat_id' => env('TELEGRAM_BOT_CHAT_ID', ''),
'notify_chat_ids' => explode(
',',
env('TELEGRAM_NOTIFY_CHAT_IDS', '')
),

/**
* Set the chat IDs that will receive notifications
* You can add the owner bot ID, group ID, ...
* -------------------------------------------------------
* Note:
* Please use semicolon ";" to separate chat ids
* And use a colon ":" to separate chat ID and thread ID
* And use comma "," if you want to add multiple thread IDs
* -------------------------------------------------------
* The environment variable is expected to be in the format:
* "chat_id1;chat_id2:thread_id2;chat_id3:thread_id3_1,thread_id3_2;...".
*/
'notify_chat_ids' => env('TELEGRAM_NOTIFY_CHAT_IDS', ''),
],

'author' => [
'discussion' => env('TGN_AUTHOR_CONTACT', 'https://t.me/tannp27'),
'discussion' => env(
'TGN_AUTHOR_DISCUSSION',
'https://github.com/lbiltech/laravel-telegram-git-notifier/discussions'
),
'source_code' => env(
'TGN_AUTHOR_SOURCE_CODE',
'https://github.com/lbiltech/laravel-telegram-git-notifier'
),
],

/** Set the path to the data file */
'data_file' => [
'setting' => env(
'TGN_PATH_SETTING',
storage_path('/app/json/tgn/tgn-settings.json')
),

'platform' => [
'gitlab' => env(
'TGN_PATH_PLATFORM_GITLAB',
storage_path('/app/json/tgn/gitlab-events.json')
),
'github' => env(
'TGN_PATH_PLATFORM_GITHUB',
storage_path('/app/json/tgn/github-events.json')
),
],
],

/** Set the path to the view file */
'view' => [
'event' => [
'default' => env(
'TGN_VIEW_DEFAULT',
base_path('resources/views/vendor/telegram-git-notifier')
),

'event' => [
'default' => env('TGN_VIEW_EVENT_DEFAULT', 'default'),
],

'globals' => [
'access_denied' => env(
'TGN_VIEW_GLOBALS_ACCESS_DENIED',
'globals.access_denied'
),
],
'tools' => [

'tools' => [
'settings' => env(
'TGN_VIEW_TOOL_SETTING',
'tools.settings'
Expand All @@ -53,4 +95,5 @@
),
],
],

];
10 changes: 7 additions & 3 deletions src/Providers/TelegramGitNotifierServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,15 @@ public function boot(): void
$this->loadRoutesFrom($routePath);
}

$helperPath = __DIR__.'/../../common/helpers.php';
if (file_exists($helperPath)) {
require_once $helperPath;
$viewPath = __DIR__.'/../../resources/views';
if (file_exists($viewPath)) {
$this->loadViewsFrom($viewPath, 'telegram-git-notifier');
}

$this->publishes([
__DIR__.'/../../resources/views' => base_path('resources/views/vendor/telegram-git-notifier'),
], 'views');

$this->loadTranslationsFrom(__DIR__.'/../../lang', 'telegram-git-notifier');

$this->publishes([
Expand Down