question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom config template name - my-serverless.yml

See original GitHub issue

This 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:closed
  • Created 6 years ago
  • Reactions:42
  • Comments:19 (11 by maintainers)

github_iconTop GitHub Comments

14reactions
horike37commented, Jan 9, 2018

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.:

# serverless.yml
provider: ...
functions: ${file(${opt:config-file}):functions}
resources: ${file(${opt:config-file}):resources}

and then just invoke serverless as: sls deploy --config-file <path/to/config>. The opt variable allows you to specify any custom arguments of the command line. https://serverless.com/framework/docs/providers/aws/guide/variables#referencing-cli-options

Could you try it?

7reactions
marcelpansecommented, Sep 25, 2018

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS Lambda Guide - Serverless.yml Reference
Here is a list of all available properties in serverless.yml when the provider is set to aws . ... Use a custom name...
Read more >
Variables - Serverless Framework
Variables allow users to dynamically replace config values in serverless.yml config. They are especially useful when providing secrets for your service to ...
Read more >
Serverless Framework Commands - AWS Lambda - Create
Create a service in a new folder using a custom template: Copied. serverless create ... --name or -n the name of the service...
Read more >
Plugins - Extending the configuration - Serverless Framework
Plugin can extend the serverless.yml syntax with custom configuration: ... In the example above, the plugin adds a new documentation property on http...
Read more >
Serverless Framework Commands - AWS Lambda - Print
Print your serverless.yml config file with all variables resolved. ... custom: bucketName: test. provider: name: aws. runtime: nodejs14.x. functions:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found