You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to see support for Javascript files as an additional configuration format. The current YAML format works fine, but a JS file could give the following advantages:
For large services, you can easily split the configuration file into smaller pieces
It would be easier to make differences, e.g. based on environment or region (side note: you need to have access to some environment variables to do this)
This would allow re-use of configuration parts (e.g. from your internal NPM modules)
This would allow auto-generation of (parts of) the configuration (e.g. from a Swagger/OpenAPI spec)
It could work similar to how Webpack does it. A file named serverless.js or serverless.config.js could simply export a CommonJS module, containing the configuration object.
Looking forward to your feedback!
The text was updated successfully, but these errors were encountered:
This would be really awesome! For those of us that despise YAML, json is the only option but JSON doesn't support comments so its a huge drag. I make a lot of use of the node-config package and its ability to use js config files has been great. In one of my serverless projects I've even gone as far as to wrap all my serverless calls with yarn and compile my own serverless.js file into a build directory as serverless.json and run it from there. This works but has the unfortunate side effect of not being able to run serverless cli at the top level.
I was just poking around the repo to see how tricky this might be when I ran across this proposal. It looks like it would be very simple to add support for this when loading the file but there are a few places around the code base where the various formats are mentioned.
This is a Feature Proposal
Description
I would like to see support for Javascript files as an additional configuration format. The current YAML format works fine, but a JS file could give the following advantages:
It could work similar to how Webpack does it. A file named
serverless.js
orserverless.config.js
could simply export a CommonJS module, containing the configuration object.Looking forward to your feedback!
The text was updated successfully, but these errors were encountered: