Skip to content

Commit 54b43fd

Browse files
committed
Add GitHub authentication for API requests, to prevent limits.
1 parent f166658 commit 54b43fd

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ TG_PATHS='{"download": "${TG_DOWNLOADS_DIR}", "upload": "${TG_UPLOADS_DIR}"}'
3434
# Webhook secrets
3535
TG_WEBHOOK_SECRET_GITHUB='github-secret'
3636

37+
# GitHub API token
38+
TG_GITHUB_AUTH_USER='github-user'
39+
TG_GITHUB_AUTH_TOKEN='github-token'
40+
3741
# Telegram Payments
3842
TG_PAYMENT_PROVIDER_TOKEN='123:TEST:abc'
3943

public/webhooks/github.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ function parseReleaseBody($body, $user, $repo): string
113113
}, $body);
114114

115115
$github_client = new Client();
116+
$github_client->authenticate(getenv('TG_GITHUB_AUTH_USER'), getenv('TG_GITHUB_AUTH_TOKEN'));
116117
$github_client->addCache(new Pool(new MySQL(
117118
new PDO('mysql:dbname=' . getenv('TG_DB_DATABASE') . ';host=' . getenv('TG_DB_HOST'), getenv('TG_DB_USER'), getenv('TG_DB_PASSWORD'))
118119
)));

0 commit comments

Comments
 (0)