-
Notifications
You must be signed in to change notification settings - Fork 105
/
shared.go
41 lines (34 loc) · 1.31 KB
/
shared.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
41
//go:build shared
// +build shared
// This file provides a build target while building the dynamically loadable shared object library.
// It imports github.com/mergestat/mergestat-lite/extensions which provides the actual extension implementation.
package main
import (
"os"
"github.com/go-git/go-git/v5/plumbing/transport/http"
"github.com/mergestat/mergestat-lite/extensions"
"github.com/mergestat/mergestat-lite/extensions/options"
"github.com/mergestat/mergestat-lite/pkg/locator"
"go.riyazali.net/sqlite"
)
func init() {
multiLocOpt := &locator.MultiLocatorOptions{
InsecureSkipTLS: os.Getenv("GIT_SSL_NO_VERIFY") != "",
}
githubToken := os.Getenv("GITHUB_TOKEN")
if githubToken != "" {
multiLocOpt.HTTPAuth = &http.BasicAuth{Username: githubToken}
}
sqlite.Register(extensions.RegisterFn(
options.WithExtraFunctions(),
options.WithRepoLocator(locator.CachedLocator(locator.MultiLocator(multiLocOpt))),
options.WithGitHub(),
options.WithContextValue("githubToken", githubToken),
options.WithContextValue("githubPerPage", os.Getenv("GITHUB_PER_PAGE")),
options.WithContextValue("githubRateLimit", os.Getenv("GITHUB_RATE_LIMIT")),
options.WithSourcegraph(),
options.WithContextValue("sourcegraphToken", os.Getenv("SOURCEGRAPH_TOKEN")),
options.WithNPM(),
))
}
func main() { /* noting here fellas */ }