-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
40 lines (33 loc) · 778 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// SPDX-FileCopyrightText: 2024 Humaid Alqasimi <https://huma.id>
// SPDX-License-Identifier: AGPL-3.0-or-later WITH GPL-3.0-linking-exception
package main
import (
"os"
"github.com/charmbracelet/log"
"github.com/google/go-github/v63/github"
)
var (
port string
githubToken string
)
func loadEnv() {
if os.Getenv("PORT") != "" {
port = os.Getenv("PORT")
} else {
port = "8082"
}
if os.Getenv("GITHUB_TOKEN") != "" {
githubToken = os.Getenv("GITHUB_TOKEN")
client = github.NewClient(nil).WithAuthToken(githubToken)
} else {
client = github.NewClient(nil)
log.Warn("GITHUB_TOKEN is not set, you may hit the API rate limit...")
}
}
var indexer *Indexer
func main() {
loadEnv()
indexer = NewIndexer()
go indexer.LoadCache()
runWebServer()
}