From 0b536901e58b90a3cdad64f4600184264bdfc8bd Mon Sep 17 00:00:00 2001 From: tobias-farrenkopf Date: Thu, 19 Oct 2023 17:36:34 +0100 Subject: [PATCH] feat: make base_url configurable This will support Github Enterprise Server installations --- codeowners/provider.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/codeowners/provider.go b/codeowners/provider.go index ff6578d6..dab81308 100644 --- a/codeowners/provider.go +++ b/codeowners/provider.go @@ -53,6 +53,13 @@ func Provider() *schema.Provider { DefaultFunc: schema.EnvDefaultFunc("GITHUB_USERNAME", nil), Sensitive: true, }, + "base_url": { + Type: schema.TypeString, + Optional: true, + Description: "GitHub base API endpoint", + DefaultFunc: schema.EnvDefaultFunc("GITHUB_BASE_URL", "https://api.github.com/"), + Sensitive: true, + }, }, ResourcesMap: map[string]*schema.Resource{ "codeowners_file": resourceFile(), @@ -74,7 +81,7 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) { c := tpg.Config{ Token: d.Get("github_token").(string), - BaseURL: "https://api.github.com/", + BaseURL: d.Get("base_url").(string), } gc, err := c.NewRESTClient(c.AuthenticatedHTTPClient())