mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Config EnvVars passed without leading _ (#534)
* Earlier X=Y was passed as _X=Y Signed-off-by: Goutham Veeramachaneni <cs14btech11014@iith.ac.in>
This commit is contained in:
committed by
Travis Reeder
parent
f6317582c2
commit
fae66764b4
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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])
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user