Skip to content

Commit

Permalink
refactor: remove endpoint from providerConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
Geun-Oh committed Sep 6, 2024
1 parent ff2c21f commit 445487a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
1 change: 0 additions & 1 deletion internal/conn/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,5 @@ type ProviderConfig struct {
SupportVPC bool
RegionCode string
RegionNo string
Endpoint string
Client *NcloudAPIClient
}
10 changes: 4 additions & 6 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,6 @@ func ProviderConfigure(ctx context.Context, d *schema.ResourceData) (interface{}
}
}

// Set endpoint
if endpoint, ok := getOrFromEnv(d, "endpoint", "NCLOUD_ENDPOINT"); ok {
providerConfig.Endpoint = endpoint.(string)
}

// Fin only supports VPC
if providerConfig.Site == "fin" {
providerConfig.SupportVPC = true
Expand All @@ -231,7 +226,10 @@ func ProviderConfigure(ctx context.Context, d *schema.ResourceData) (interface{}
Region: region.(string),
}

if client, err := config.Client(providerConfig.Site, providerConfig.Endpoint); err != nil {
// Set endpoint
endpoint, _ := getOrFromEnv(d, "endpoint", "NCLOUD_OBS_ENDPOINT")

if client, err := config.Client(providerConfig.Site, (endpoint).(string)); err != nil {
return nil, diag.FromErr(err)
} else {
providerConfig.Client = client
Expand Down

0 comments on commit 445487a

Please sign in to comment.