serverless-wsgi icon indicating copy to clipboard operation
serverless-wsgi copied to clipboard

Provide function to execute when calling sls wsgi command

Open estahn opened this issue 2 years ago • 3 comments

We run django in AWS Lambda and want to apply database migrations via sls wsgi manage. The database user the application runs with is limited and not allowed to create/alter tables. Thus we want to define an alternate Lambda function with different environment variables providing database admin credentials. This is primarily a security concern to segregate the database base user the application uses from the database user the migration script uses.

findHandler currently returns the first function with condition handler: wsgi_handler.handler.

https://github.com/logandk/serverless-wsgi/blob/master/index.js#L436C7-L440

Instead of returning the first function, if --function / -f (required) is specified, the specified function should be used.

estahn avatar Jul 03 '23 21:07 estahn