sst / ion

❍ — a new engine for SST
https://ion.sst.dev
MIT License
1.09k stars 129 forks source link

Add a linkable Parameter component #379

Closed bchilcott closed 1 month ago

bchilcott commented 1 month ago

There should be a parameter component, similar to the old SST v2 Parameter, for linking non-secret configuration instead of having to use environment. Could look something like:

const someConfig = new sst.Parameter("SomeConfig", "some-non-secret-value");
// or...
const someConfig = new sst.Parameter("SomeConfig", {
  value: "some-non-secret-value"
});

const myFn = new sst.aws.Function("MyFn", {
  handler: "src/functions/MyFn.handler",
  link: [someConfig]
});
thdxr commented 1 month ago

you can actually use new sst.Secret("SomeConfig", "myvalue") - does that work for you?

bchilcott commented 1 month ago

you can actually use new sst.Secret("SomeConfig", "myvalue") - does that work for you?

Ah yes that works - thanks. Feel free to close this but I suppose it would be nice if we could link more complex types? Arrays, etc. Definitely not a priority though, this works perfectly.

jackblanc commented 1 month ago

Does Secret actually store anything if you set a default value? I'm looking into using this to make D1 HTTP work, but it feels a little hacky. I want to avoid duplicating the value - if Secret doesn't actually store the default, probably fine?