We are using pulumi with typescript and a pulumi y...
# kubernetes
We are using pulumi with typescript and a pulumi yaml config file. We have included “enableIstio”: false using “pulumi config set enableIstio false”. If we use let blabla = config.getBoolean(“enableIstio”) || true it always results in true so I assume we cannot use this example? I know that typescript defines it as such. For let blabla = config.getNumber(“somenumber”) || 20 is working correctly except in the case where your number is a 0 (=false). A bit of a gotcha as a lot of these code examples use || and not ??
have you instantiated the config? e.g.
const x = new pulumi.Config();
Hi,Paul. Yes we use
Copy code
const config = new pulumi.Config(“pulumi”)
Drop the Pulumi part and try it - I don’t believe you need that
if Indo a console.log it returns the correct value so it reads the config directly
I think you should use ?? for numbers and bools, not || to provide default values
Yes - you are right about the gotcha here (if you see any Pulumi example code that has a bug due to this let us know). The
operator was just added to TypeScript 2 months ago, and is not widely known syntax yet - which is the primary reason it’s not used in examples yet. It is indeed closer to the desired semantics for this use case.
👍 1