https://pulumi.com logo
#typescript
Title
# typescript
o

orange-kite-80991

11/07/2021, 5:29 PM
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

limited-rainbow-51650

11/07/2021, 6:48 PM
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

orange-kite-80991

11/07/2021, 7:00 PM
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.