Open boyney123 opened 1 month ago
@boyney123 What's the use case for passing these environment variables to all api routes?
Hmm yeah good question 😅
Mainly usecases if the API (service) is integrating with 3rd party systems (cloud cache, cloud DB etc), and maybe to share these ENV across all routes in the API? S3 urls etc that they all need access too? Or API URLS they all need access too?
I know previously I have done things with SAM using Globals
Now I think about it more I'm unsure if its really required tbh... maybe we should keep this issue see if any users come back in the future and express interest (or not!).
Use Case
When defining a Cloud.API we can configure a few props (cors and corsOptions).
When we define routes on the API resource we can also add
env
to them (see example of GET)This is a proposal to allow the
cloud.Api
resource to define these at a high level (when we define the resource itself) through it's (ApiProps). Settingenv
values here would apply to all routes configured in the API.Proposed Solution
Allow user to define env variables when creating a new API.
Implementation Notes
No response
Component
No response
Community Notes