-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #834 from snyk/fix/and-or-github-app-plugin
fix: allow one or more matching connection types for plugin enablement
- Loading branch information
Showing
4 changed files
with
75 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import BrokerPlugin from '../../../lib/client/brokerClientPlugins/abstractBrokerPlugin'; | ||
|
||
export class Plugin extends BrokerPlugin { | ||
pluginCode = 'DUMMYMULTI'; | ||
pluginName = 'Dummy Plugin Multi'; | ||
description = ` | ||
dummy plugin multi 1 2 | ||
`; | ||
version = '0.1'; | ||
applicableBrokerTypes = ['dummy-multi-1', 'dummy-multi-2']; | ||
|
||
isPluginActive() { | ||
if (this.brokerClientConfiguration.DISABLE_DUMMY_PLUGIN) { | ||
this.logger.debug({ plugin: this.pluginName }, 'Disabling plugin'); | ||
return false; | ||
} | ||
return true; | ||
} | ||
async startUp(connectionConfig) { | ||
this.logger.info({ plugin: this.pluginName }, 'Running Startup'); | ||
this.logger.info( | ||
{ config: connectionConfig }, | ||
'Connection Config passed to the plugin', | ||
); | ||
connectionConfig['NEW_VAR_ADDED_TO_CONNECTION'] = 'access-token'; | ||
} | ||
|
||
async preRequest(connectionConfiguration, postFilterPreparedRequest) { | ||
this.logger.info({ plugin: this.pluginName }, 'Running prerequest plugin'); | ||
const customizedRequest = postFilterPreparedRequest; | ||
customizedRequest.body['NEW_VAR_ADDED_TO_CONNECTION'] = | ||
connectionConfiguration['NEW_VAR_ADDED_TO_CONNECTION']; | ||
return customizedRequest; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters