Skip to content
Permalink
Browse files

add support for overriding NODE_ENV. Closes #505

  • Loading branch information...
tj committed Dec 27, 2017
1 parent 9f9d7ce commit 13b3b090de397b9db6cac86a688a90358e606922
Showing with 5 additions and 1 deletion.
  1. +5 −1 platform/lambda/runtime/runtime.go
@@ -37,6 +37,10 @@ func WithLogger(l log.Interface) Option {
// Init implementation.
func (r *Runtime) Init(stage string) error {
os.Setenv("UP_STAGE", stage)
os.Setenv("NODE_ENV", stage)

if s := os.Getenv("NODE_ENV"); s == "" {
os.Setenv("NODE_ENV", stage)
}

return nil
}

3 comments on commit 13b3b09

@matsilva

This comment has been minimized.

Copy link

replied Dec 27, 2017

Awesome! I am new to go, but if I am reading it correctly this is going to override NODE_ENV with the stage variable? Sorry for dumb questions ¯_(ツ)_/¯... I am just interested in learning go.

@tj

This comment has been minimized.

Copy link
Member Author

replied Dec 27, 2017

only if it == "" :D the Getenv() will give you an empty string if it's not defined, but I should just do if os.Getenv("NODE_ENV") == "" hahah... no reason for the var

@matsilva

This comment has been minimized.

Copy link

replied Dec 27, 2017

empty string if it's not defined

☝️ that explains a lot. Thanks!

Please sign in to comment.
You can’t perform that action at this time.