From fae66764b4d34d3b15bb4688dc691637375df7ce Mon Sep 17 00:00:00 2001 From: Goutham Veeramachaneni Date: Sat, 4 Mar 2017 05:47:00 +0530 Subject: [PATCH] Config EnvVars passed without leading _ (#534) * Earlier X=Y was passed as _X=Y Signed-off-by: Goutham Veeramachaneni --- api/server/runner.go | 3 +++ api/server/runner_async_test.go | 3 --- docs/writing.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/server/runner.go b/api/server/runner.go index 7f0b68c36..4cf720459 100644 --- a/api/server/runner.go +++ b/api/server/runner.go @@ -61,6 +61,9 @@ func (s *Server) handleSpecial(c *gin.Context) { func toEnvName(envtype, name string) string { name = strings.ToUpper(strings.Replace(name, "-", "_", -1)) + if envtype == "" { + return name + } return fmt.Sprintf("%s_%s", envtype, name) } diff --git a/api/server/runner_async_test.go b/api/server/runner_async_test.go index 13bd05052..5915799ac 100644 --- a/api/server/runner_async_test.go +++ b/api/server/runner_async_test.go @@ -90,9 +90,6 @@ func TestRouteRunnerAsyncExecution(t *testing.T) { if test.expectedEnv != nil { for name, value := range test.expectedEnv { taskName := name - if name == "APP" || name == "TEST" { - taskName = fmt.Sprintf("_%s", name) - } if value != task.EnvVars[taskName] { t.Errorf("Test %d: Expected header `%s` to be `%s` but was `%s`", i, name, value, task.EnvVars[taskName]) diff --git a/docs/writing.md b/docs/writing.md index 6c07eff0a..376a3867f 100644 --- a/docs/writing.md +++ b/docs/writing.md @@ -35,7 +35,7 @@ You will also have access to a set of environment variables. * ROUTE - the matched route * METHOD - the HTTP method for the request * HEADER_X - the HTTP headers that were set for this request. Replace X with the upper cased name of the header and replace dashes in the header with underscores. -* any configuration values you've set for the Application or the Route. Replace X with the upper cased name of the config variable you set. +* X - any configuration values you've set for the Application or the Route. Replace X with the upper cased name of the config variable you set. Ex: `minio_secret=secret` will be exposed via MINIO_SECRET env var Warning: these may change before release.