Skip to content

Commit

Permalink
Merge pull request #198 from cingulo/feature/support-subfolder-handler
Browse files Browse the repository at this point in the history
Support handler located at subfolder
  • Loading branch information
logandk authored Dec 7, 2021
2 parents 0e5789b + 3f4cf44 commit 46f4608
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ServerlessWSGI {

_.each(this.serverless.service.functions, (func) => {
if (func.handler == "wsgi.handler") {
func.handler = "wsgi_handler.handler";
func.handler = func.handler.replace("wsgi.handler", "wsgi_handler.handler");
handlersFixed = true;
}
});
Expand Down Expand Up @@ -67,7 +67,7 @@ class ServerlessWSGI {
) {
let handler = _.find(
this.serverless.service.functions,
(fun) => fun.handler == "wsgi_handler.handler"
(fun) => _.includes(fun.handler, "wsgi_handler.handler")
);

// serverless-python-requirements supports packaging individual functions
Expand Down Expand Up @@ -359,7 +359,7 @@ class ServerlessWSGI {
_.merge(process.env, providerEnvVars);

_.each(this.serverless.service.functions, (func) => {
if (func.handler == "wsgi_handler.handler") {
if (_.includes(func.handler, "wsgi_handler.handler")) {
const functionEnvVars = _.omitBy(func.environment || {}, _.isObject);
_.merge(process.env, functionEnvVars);
}
Expand Down Expand Up @@ -433,7 +433,7 @@ class ServerlessWSGI {
findHandler() {
return _.findKey(
this.serverless.service.functions,
(fun) => fun.handler == "wsgi_handler.handler"
(fun) => _.includes(fun.handler, "wsgi_handler.handler")
);
}

Expand Down Expand Up @@ -814,7 +814,7 @@ class ServerlessWSGI {
"after:package:createDeploymentArtifacts": deployAfterHook,

"before:deploy:function:packageFunction": () => {
if (this.options.functionObj.handler == "wsgi_handler.handler") {
if (_.includes(this.options.functionObj.handler, "wsgi_handler.handler")) {
return deployBeforeHook();
} else {
return deployBeforeHookWithoutHandler();
Expand All @@ -833,7 +833,7 @@ class ServerlessWSGI {
return BbPromise.bind(this)
.then(this.validate)
.then(() => {
if (functionObj.handler == "wsgi_handler.handler") {
if (_.includes(functionObj.handler, "wsgi_handler.handler")) {
return this.packWsgiHandler(false);
} else {
return BbPromise.resolve();
Expand Down

0 comments on commit 46f4608

Please sign in to comment.