From ccadef90d2bcf1e30708d4f2a43f90b88ac8d624 Mon Sep 17 00:00:00 2001 From: "Giau. Tran Minh" Date: Thu, 2 Jan 2025 13:01:34 +0700 Subject: [PATCH] internal: handle empty API URL from env --- internal/bitbucket/bitbucket.go | 3 +++ internal/github/github.go | 3 +++ internal/gitlab/gitlab.go | 3 +++ 3 files changed, 9 insertions(+) diff --git a/internal/bitbucket/bitbucket.go b/internal/bitbucket/bitbucket.go index 06111903..f6819df2 100644 --- a/internal/bitbucket/bitbucket.go +++ b/internal/bitbucket/bitbucket.go @@ -181,6 +181,9 @@ func NewClient(workspace, repoSlug string, opts ...ClientOption) (*Client, error return nil, err } } + if c.baseURL == "" { + c.baseURL = DefaultBaseURL + } return c, nil } diff --git a/internal/github/github.go b/internal/github/github.go index 3e85a94c..acbc1084 100644 --- a/internal/github/github.go +++ b/internal/github/github.go @@ -102,6 +102,9 @@ func NewClient(repo string, opts ...ClientOption) (*Client, error) { return nil, err } } + if c.baseURL == "" { + c.baseURL = DefaultBaseURL + } return c, nil } diff --git a/internal/gitlab/gitlab.go b/internal/gitlab/gitlab.go index e281888d..a16e46e3 100644 --- a/internal/gitlab/gitlab.go +++ b/internal/gitlab/gitlab.go @@ -61,6 +61,9 @@ func NewClient(project string, opts ...ClientOption) (*Client, error) { return nil, err } } + if c.baseURL == "" { + c.baseURL = DefaultBaseURL + } return c, nil }