Newbie Q: What syntax do I need to load all my Pu...
# typescript
o
Newbie Q: What syntax do I need to load all my Pulumi Config key-value pairs? ... edit ... After a pile of noise, you can load Config as a KV map using
Copy code
pulumi.runtime.allConfig()
The following doesn't work:
Copy code
const config = new pulumi.Config()
const all_envs_str = "'" + 
  Object.entries(config).map(([key, value]) => `${key}=${value}`).join('\n') + "'"

Result:
name=my_project_name
BTW my overall objective is sending all the Config key-values, including secrets to Docker. If there's a less hacky way to do this I'm all ears.
l
That is because
name
is the only Typescript property on the
Config
object: https://www.pulumi.com/docs/reference/pkg/nodejs/pulumi/pulumi/#Config-name
In all my infra code so far, I used the regular
get
methods to retrieve a single value (https://www.pulumi.com/docs/reference/pkg/nodejs/pulumi/pulumi/#Config-get) or I used structured configuration (https://www.pulumi.com/docs/intro/concepts/config/#structured-configuration)
The closest you can get is to have all the configuration you want to pass to Docker as structured configuration and use
config.requireObject<YourInterfaceType>(<yourConfigKey>)
o
thx Ringo. With Docker you need config.get, then ARG & ENV. Redeclaring each named variable 3+ times was getting out of hand. I saw Structured Config. Happy to go there but was wondered if I was missing something basic.