Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support JS configuration to make configuration more flexible #3269

Closed
joostfarla opened this issue Feb 19, 2017 · 1 comment
Closed

Support JS configuration to make configuration more flexible #3269

joostfarla opened this issue Feb 19, 2017 · 1 comment

Comments

@joostfarla
Copy link
Member

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:

  • 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!

@fantapop
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants