A development team is utilizing a serverless architecture for their application. They need to ensure that the application performs optimally during different stages of deployment such as development, testing, and production. The serverless function requires specific configuration data that should change depending on the stage without altering the function's code. Which method facilitates the function's ability to adapt its behavior dynamically in response to the deployment stage?
Implement a file in a cloud storage service that stores the configuration information, which the serverless function checks upon every invocation.
Maintain multiple versions of the serverless function, each tailored to a specific deployment environment.
Embed environment-specific code branches within the serverless function, with logic to select the right branch during execution.
Configure environmental parameters on the serverless API endpoint that are passed to the serverless function during invocation.