config
Overview of the config module in the sst/node package.
import { ... } from "sst/node/config"
The config module has the following exports.
Properties
The properties let you access the resources that are bound to the function.
Config
This module helps with loading Secrets and Parameters created in your SST app.
import { Config } from "sst/node/config";
console.log(Config.STRIPE_KEY);
When you import sst/node/config, it does two things:
- For Secrets,
Configperforms a top-level await to fetch and decrypt the secrets values from SSM ie./sst/{appName}/{stageName}/Secret/STRIPE_KEY/value. Once fetched, you can referenceConfig.STRIPE_KEYdirectly in your code. - For Parameters,
Configreads the parameter values from Lambda environment variables, ie.process.env.SST_Parameter_value_APP_VERSIONand assigns toConfig.APP_VERSION.
Read more about how Config works in the chapter on Config.