-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix scenario where env vars are empty #85
Conversation
pkg/infra/pulumi_aws/index.ts.tmpl
Outdated
@@ -112,7 +112,7 @@ export = async () => { | |||
{{range $unit := .ExecUnits -}} | |||
|
|||
{{- if eq $unit.Type "fargate"}} | |||
cloudLib.createEcsService("{{$unit.Name}}",{{jsonPretty $unit.Params | indent 4}} as Partial<awsx.ecs.Container>, {{- if $unit.EnvironmentVariables}} , {{jsonPretty $unit.EnvironmentVariables | indent 4}} {{end}}); | |||
cloudLib.createEcsService("{{$unit.Name}}",{{jsonPretty $unit.Params | indent 4}} as Partial<awsx.ecs.Container>, {{- if $unit.EnvironmentVariables}} {{jsonPretty $unit.EnvironmentVariables | indent 4}} {{else}} [] {{end}}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like the library can handle the undefined
fine:
generateExecUnitEnvVars(
execUnitName: string,
env_vars?: any[]
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so you're saying, just rm the if-else altogether? let me check if that works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm saying the previous version should be fine since the ,
is also included in the original if statement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, it did! nice catch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm saying the previous version should be fine since the
,
is also included in the original if statement.
Ah, well that's not fine. The problem wasn't the lack of ,
, it was that there was nothing after the comma, so the method invocation only had two args, while it expected 3. The problem wasn't the generateExecUnitEnvVars
invocation, it was the createEcsService
invocation.
|
When the env var was empty, the end of the method call was
, )
instead of,[])
.Standard checks