Skip to content

Commit

Permalink
Merge pull request #47 from Roblox/trim_env_vars
Browse files Browse the repository at this point in the history
Trim Env Vars
  • Loading branch information
Dustin Taylor authored Feb 22, 2021
2 parents f8232d1 + c88071f commit 1bee27d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion iis/iis.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,8 @@ func applyAppPoolEnvVars(appPoolName string, envVars map[string]string) error {
properties := []string{"set", "config", "-section:system.applicationHost/applicationPools"}

for key, val := range envVars {
if strings.Trim(key, " ") == "" {
key = strings.Trim(key, " ")
if key == "" {
continue
}
if keyExists, isSameValue := doesAppPoolEnvVarExistWithSameValue(appPool, key, val); keyExists {
Expand Down
2 changes: 2 additions & 0 deletions iis/iis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ func TestWebsite(t *testing.T) {
"EXAMPLE_ENV_VAR_ALT": "test123",
"": "INVALID",
" ": "INVALID_SPACE",
" FUN_SPACE ": "test456",
},
AppPoolIdentity: iisAppPoolIdentity{
Identity: "SpecificUser",
Expand Down Expand Up @@ -340,6 +341,7 @@ func TestWebsite(t *testing.T) {
expectedAppPoolEnvVars := []appPoolAddEnvVar{
{Name: "EXAMPLE_ENV_VAR", Value: "test123"},
{Name: "EXAMPLE_ENV_VAR_ALT", Value: "test789"},
{Name: "FUN_SPACE", Value: "test456"},
}

assert.ElementsMatch(expectedAppPoolEnvVars, appPool.Add.EnvironmentVariables.Add, "AppPool EnvironmentVariables don't match!")
Expand Down

0 comments on commit 1bee27d

Please sign in to comment.