This message was deleted.
# general
s
This message was deleted.
h
I think that once your specific configuration gets complex, you want to put it in it's own interface & function. Just using
pulumi.Config()
on its own quickly gets unwieldy. So for example I have a config like so:
Copy code
export interface ConfigSettings {
  ssmParameterName: string
  subdomain?: string
  tld: TLD
  docsDir: string
}
and then I load it in a function that provides reasonable defaults:
Copy code
function getConfig(): ConfigSettings {
  const config = new pulumi.Config("deploy"),
    ssmParameterName = config.require<string>("docsDeployParam"),
    tld = config.get<TLD>("tld") || "dev",
    subdomain = config.get("subdomain"),
    docsDir = config.get("docsDir") || "../content/build"

  return { ssmParameterName, tld, subdomain, docsDir }
}
And the rest of my program is only aware of my local
getConfig
and
ConfigSettings
definitions.
s
Thanks, that's good feedback. I agree I'd like to avoid passing around a giant global config object, but I also don't want to be calling pulumi.Config() all over the place.
❤️ 1