Skip to content

Commit

Permalink
fix: env var naming
Browse files Browse the repository at this point in the history
  • Loading branch information
1riatsila1 committed Dec 2, 2024
1 parent 24f28aa commit c4cbd84
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions internal/provider/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func getEnv(key, fallback string) string {
}

func InitializeConfig() {
Host = getEnv("UXI_HOST", UXIDefaultHost)
ClientID = os.Getenv("GREENLAKE_UXI_CLIENT_ID")
ClientSecret = os.Getenv("GREENLAKE_UXI_CLIENT_SECRET")
Host = getEnv("HPEUXI_HOST_OVERRIDE", UXIDefaultHost)
ClientID = os.Getenv("HPEUXI_CLIENT_ID")
ClientSecret = os.Getenv("HPEUXI_CLIENT_SECRET")
}
8 changes: 4 additions & 4 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ func (p *hpeuxiConfigurationProvider) Schema(
"client_id": schema.StringAttribute{
Description: "The Client ID as obtained from HPE GreenLake API client credentials. " +
"It is recommended that this configuration is left blank and the Client ID " +
"is exported as the `GREENLAKE_UXI_CLIENT_ID` environment variable instead.",
"is exported as the `HPEUXI_CLIENT_ID` environment variable instead.",
Optional: true,
},
"client_secret": schema.StringAttribute{
Description: "The Client Secret as obtained from HPE GreenLake API client credentials. " +
"It is recommended that this configuration is left blank and the Client Secret " +
"is exported as the `GREENLAKE_UXI_CLIENT_SECRET` environment variable instead.",
"is exported as the `HPEUXI_CLIENT_SECRET` environment variable instead.",
Optional: true,
Sensitive: true,
},
Expand Down Expand Up @@ -113,7 +113,7 @@ func (p *hpeuxiConfigurationProvider) Configure(
path.Root("client_id"),
"Missing Client ID",
"The provider cannot initialize as there is a missing or empty value for the Client ID. "+
"Set the client_id value in the provider configuration or use the GREENLAKE_UXI_CLIENT_ID "+
"Set the client_id value in the provider configuration or use the HPEUXI_CLIENT_ID "+
"environment variable (recommended). If either is already set, ensure the value is not empty.",
)
}
Expand All @@ -123,7 +123,7 @@ func (p *hpeuxiConfigurationProvider) Configure(
path.Root("client_secret"),
"Missing Client Secret",
"The provider cannot initialize as there is a missing or empty value for the Client Secret. "+
"Set the client_secret value in the provider configuration or use the GREENLAKE_UXI_CLIENT_SECRET "+
"Set the client_secret value in the provider configuration or use the HPEUXI_CLIENT_SECRET "+
"environment variable (recommended). If either is already set, ensure the value is not empty.",
)
}
Expand Down
2 changes: 1 addition & 1 deletion test/live/resources/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestAgentResource(t *testing.T) {
// we provision an agent here so that we have something to delete later on
agentID, err := util.ProvisionAgent{
CustomerID: config.CustomerID,
ProvisionToken: os.Getenv("hpeuxi_PROVISION_TOKEN"),
ProvisionToken: os.Getenv("HPEUXI_PROVISION_TOKEN"),
DeviceSerial: config.AgentCreateSerial,
DeviceGatewayHost: config.DeviceGatewayHost,
}.Provision()
Expand Down
4 changes: 2 additions & 2 deletions test/mocked/datasources/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import (
)

func TestMain(m *testing.M) {
os.Setenv("UXI_HOST", util.MockDomain)
os.Setenv("HPEUXI_HOST_OVERRIDE", util.MockDomain)

exitCode := m.Run()

os.Unsetenv("UXI_HOST")
os.Unsetenv("HPEUXI_HOST_OVERRIDE")

os.Exit(exitCode)
}
4 changes: 2 additions & 2 deletions test/mocked/resources/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import (
)

func TestMain(m *testing.M) {
os.Setenv("UXI_HOST", util.MockDomain)
os.Setenv("HPEUXI_HOST_OVERRIDE", util.MockDomain)

exitCode := m.Run()

os.Unsetenv("UXI_HOST")
os.Unsetenv("HPEUXI_HOST_OVERRIDE")
os.Exit(exitCode)
}

0 comments on commit c4cbd84

Please sign in to comment.