Skip to content

Commit

Permalink
chore: custom URL for GitLab from env var (#417)
Browse files Browse the repository at this point in the history
Signed-off-by: Bill Maxwell <cloudnautique@users.noreply.github.com>
  • Loading branch information
cloudnautique authored Feb 6, 2025
1 parent 4c02526 commit 10c84a9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions gitlab/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/gptscript-ai/tools/gitlab/pkg/commands"
gitlab "gitlab.com/gitlab-org/api/client-go"
"log"
"os"
"strconv"

"github.com/gptscript-ai/tools/gitlab/pkg/commands"
gitlab "gitlab.com/gitlab-org/api/client-go"
)

func main() {
Expand All @@ -18,7 +19,12 @@ func main() {

command := os.Args[1]

git, err := gitlab.NewClient(os.Getenv("GITLAB_TOKEN"))
baseURL := os.Getenv("GITLAB_BASE_URL")
if baseURL == "" {
baseURL = "https://gitlab.com/api/v4"
}

git, err := gitlab.NewClient(os.Getenv("GITLAB_TOKEN"), gitlab.WithBaseURL(baseURL))
if err != nil {
exit("Failed to create gitlab client", err)
}
Expand Down

0 comments on commit 10c84a9

Please sign in to comment.