Custom config template name - my-serverless.yml
See original GitHub issueThis is a Feature Proposal
Description
For bug reports:
- What went wrong? n/a
- What did you expect should have happened? n/a
- What was the config you used? n/a
- What stacktrace or error message from your provider did you see? n/a
For feature proposals:
- What is the use case that should be solved. The more detail you describe this in the easier it is to understand for us.
On our projects, we frequently have multiple related serverless services (typically ones that touch shared stateful resources or align to similar business domains) in the same repo to maintain a consistent life-cycle across them. We separate them into multiple services for a number of reasons - sometimes they are logical separations (the services have fundamentally separate purposes), and other times it is a technical limitation (too many resources for a single Cloudformation stack). But what we end up with is two services that need access to the same codebase and often a shared set of configuration values. It would be nice for us to store multiple serverless.yml
files side-by-side as such:
.
+-- serverless-api.yml
+-- serverless-workflow1.yml
+-- serverless-workflow2.yml
+-- app
| +-- __init__.py
| +-- py_module.py
- If there is additional config how would it look
I would imagine this could be easily implemented as a command-line option:
$ serverless deploy --configFile <path/to/config>
I would be more than happy to help make this feature a reality. A quick glance at the codebase makes it seem like the change would be relatively straight-forward.
Similar or dependent issues: None that I could find (I dug for a while, I promise).
Additional Data
- Serverless Framework Version you’re using:
- Operating System:
- Stack Trace:
- Provider Error messages:
Issue Analytics
- State:
- Created 6 years ago
- Reactions:42
- Comments:19 (11 by maintainers)
Hi, @fivepapertigers. Your problem might have been resolved by the existing variables functionality. If so, this feature doesn’t need to be introduced.
You can do that also with e.g.:
and then just invoke serverless as:
sls deploy --config-file <path/to/config>
. Theopt
variable allows you to specify any custom arguments of the command line. https://serverless.com/framework/docs/providers/aws/guide/variables#referencing-cli-optionsCould you try it?
@horike37 solution doesn’t work for plugins since the plugins are loaded before any templating happens in serverless. Currently, there doesn’t seem a way to conditionally load some plugins. This simple config file proposal would fix it without changing the way serverless currently loads the plugins before any placeholders can be used.