Skip to content

Commit 10ebb9e

Browse files
committed
Use of ConfigurationInput to get Step Functions instead of parsing config
1 parent b49efc6 commit 10ebb9e

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

index.js

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class ServerlessStepFunctionsLocal {
5858

5959
const bootstrap = (async () => {
6060
await this.startStepFunctions();
61-
await this.getStepFunctionsFromConfig();
61+
await this.getStepFunctionsFromConfigurationInput();
6262
await this.createEndpoints();
6363
})()
6464

@@ -103,25 +103,16 @@ class ServerlessStepFunctionsLocal {
103103
return this.stepfunctionsServer.stop();
104104
}
105105

106-
async getStepFunctionsFromConfig() {
107-
const {servicePath} = this.serverless.config;
106+
async getStepFunctionsFromConfigurationInput() {
108107

109-
if (!servicePath) {
110-
throw new Error('service path not found');
111-
}
112-
113-
const configPath = path.join(servicePath, 'serverless.yml');
114-
115-
const preParsed = await this.serverless.yamlParser.parse(configPath);
116-
const parsed = await this.serverless.variables.populateObject(preParsed);
108+
this.stateMachines = this.stateMachineCFARNResolver(this.serverless.configurationInput.stepFunctions.stateMachines);
117109

118-
this.stateMachines = this.stateMachineCFARNResolver(parsed.stepFunctions.stateMachines);
119-
120-
if (parsed.custom
121-
&& parsed.custom.stepFunctionsLocal
122-
&& parsed.custom.stepFunctionsLocal.TaskResourceMapping) {
123-
this.replaceTaskResourceMappings(parsed.stepFunctions.stateMachines, parsed.custom.stepFunctionsLocal.TaskResourceMapping);
110+
if (this.serverless.configurationInput.custom
111+
&& this.serverless.configurationInput.custom.stepFunctionsLocal
112+
&& this.serverless.configurationInput.custom.stepFunctionsLocal.TaskResourceMapping) {
113+
this.replaceTaskResourceMappings(this.serverless.configurationInput.stepFunctions.stateMachines, this.serverless.configurationInput.custom.stepFunctionsLocal.TaskResourceMapping);
124114
}
115+
125116
}
126117

127118
/**

0 commit comments

Comments
 (0)