Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jmwski committed May 30, 2019
1 parent ae0ffe4 commit 783d764
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions src/emulator/functionsEmulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -534,11 +534,13 @@ You can probably fix this by running "npm install ${
projectId: string,
definition: EmulatedTriggerDefinition
): Promise<any> {
const databasePort = 9000; //EmulatorRegistry.getPort(Emulators.DATABASE);
const databasePort = EmulatorRegistry.getPort(Emulators.DATABASE);
if (!databasePort) {
EmulatorLogger.log(
"INFO",
`Ignoring trigger "${definition.name}" because the Realtime Database emulator is not running`
`Ignoring trigger "${
definition.name
}" because the Realtime Database emulator is not running`
);
return Promise.resolve();
}
Expand All @@ -549,12 +551,14 @@ You can probably fix this by running "npm install ${
);
return Promise.reject();
}
const bundle = JSON.stringify([{
name: `projects/${projectId}/locations/_/functions/${definition.name}`,
path: definition.eventTrigger.resource.split("refs")[1],
event: definition.eventTrigger.eventType,
topic: `projects/${projectId}/topics/_`,
}]);
const bundle = JSON.stringify([
{
name: `projects/${projectId}/locations/_/functions/${definition.name}`,
path: definition.eventTrigger.resource.split("refs")[1],
event: definition.eventTrigger.eventType,
topic: `projects/${projectId}/topics/_`,
},
]);

EmulatorLogger.logLabeled(
"BULLET",
Expand All @@ -563,12 +567,13 @@ You can probably fix this by running "npm install ${
);
logger.debug(`addDatabaseTrigger`, JSON.stringify(bundle));
return new Promise((resolve, reject) => {
request.put(`http://localhost:${databasePort}/.settings/functionTriggers.json`,
request.put(
`http://localhost:${databasePort}/.settings/functionTriggers.json`,
{
auth: {
bearer: "owner"
bearer: "owner",
},
body: bundle
body: bundle,
},
(err, res, body) => {
if (err) {
Expand All @@ -578,7 +583,7 @@ You can probably fix this by running "npm install ${
}
resolve();
}
)
);
});
}

Expand Down

0 comments on commit 783d764

Please sign in to comment.