Jan Plaček
03/08/2022, 6:20 PMsst-evn
Or is it already possible?thdxr
03/08/2022, 6:21 PMthdxr
03/08/2022, 6:21 PMJan Plaček
03/08/2022, 6:24 PMspecify the outputs file flag
Jan Plaček
03/08/2022, 6:25 PMJan Plaček
03/08/2022, 6:28 PMJan Plaček
03/08/2022, 6:31 PMthdxr
03/08/2022, 6:32 PMJan Plaček
03/08/2022, 6:33 PMthdxr
03/08/2022, 6:33 PMJan Plaček
03/08/2022, 6:38 PMJan Plaček
03/08/2022, 6:39 PMthdxr
03/08/2022, 6:39 PM/app/stage/USER_POOL_ID
Then your script can just fetch those when it starts. I typically have a Config domain that manages all those both for my lambdas and my scriptsJan Plaček
03/08/2022, 6:42 PMJan Plaček
03/08/2022, 6:42 PMthdxr
03/08/2022, 6:43 PMthdxr
03/08/2022, 6:43 PMthdxr
03/08/2022, 6:43 PMthdxr
03/08/2022, 6:44 PMimport { StringParameter } from "aws-cdk-lib/aws-ssm"
new StringParameter(this, name, {
parameterName: `/${app.name}/${app.stage}/${name}`,
stringValue: value,
})
Jan Plaček
03/08/2022, 6:46 PMJan Plaček
03/08/2022, 6:47 PMJan Plaček
03/08/2022, 6:48 PMthdxr
03/08/2022, 6:53 PMthdxr
03/08/2022, 6:53 PMJan Plaček
03/08/2022, 7:00 PMJan Plaček
03/08/2022, 7:02 PMthdxr
03/08/2022, 7:03 PMJan Plaček
03/08/2022, 7:04 PMJan Plaček
03/08/2022, 7:17 PMaws lambda invoke
Frank
sst-env
only works with the StaticSite
construct b/c StaticSite
has the environment
concept, ie.
new StaticSite(this, "site", {
environment: {
POOL_ID: ...
},
});
And sst-env
basically sets the POOL_ID
environment variable.
@Jan Plaček how did you imagine sst-env
work when using it to run a script, ie.
sst-env -- my-node-script.js
are you looking to reference stack outputs in ur script? ie. process.env["auth.user_pool_id"]
where auth
is the name of the stack, and user_pool_id
is an output in the auth
stack?thdxr
03/08/2022, 7:59 PMJan Plaček
03/08/2022, 8:05 PMthis.addEnvironmentOutputs(id, { API_URL }
and it would add new entry to `static-site-environment-output-values.jso`;Jan Plaček
03/08/2022, 8:13 PMpath
to where I run the "web-start" command, which is at root (''
), due to nx
project structure, not in the actual angular app project directoryJan Plaček
03/08/2022, 8:14 PMpath: ''
... is that OK?Frank
path
props for StaticSite
or --path
for sst-env
command?Jan Plaček
03/08/2022, 8:16 PMFrank
Jan Plaček
03/08/2022, 8:18 PMFrank
path: ''
sounds rightFrank
Jan Plaček
03/08/2022, 8:20 PMsst-env
identifies the env vars by matching CWD with path
in -values.jsonJan Plaček
03/08/2022, 8:20 PMJan Plaček
03/08/2022, 8:21 PMFrank
sst-env
take a --name
option to point to a specific StaticSiteJan Plaček
03/08/2022, 8:32 PMFrank
id
in this context?
this.addEnvironmentOutputs(id, { API_URL });
Jan Plaček
03/08/2022, 8:34 PMJan Plaček
03/08/2022, 8:42 PMid
prop, dunno if its actually used for anything atmFrank
Frank
Jan Plaček
03/08/2022, 8:56 PMJan Plaček
03/08/2022, 8:59 PMsst-env
would eventually get the envs from SSM using the approach mentioned by @thdxrFrank
Frank
Frank
Atm we have only one site, dunno if or when we plan to add others (can let you know tomorrow). So no it’s not a blocker. Actually I didn’t even realize there could be such problem till this discussion.Let me know when this becomes a blocker. Putting in the id check should be super quick.
Jan Plaček
03/08/2022, 9:13 PM