Load the available third party integrations, these integrations can come in the form of a) Plugins implemented with go-plugin, compiled as a separate binary and placed in pluginsDir b) Built-in plugins implemented as a go modules and loaded in memory Important: Plugins have precedence over built-in
(pluginsDir string, l log.Logger)
| 64 | // b) Built-in plugins implemented as a go modules and loaded in memory |
| 65 | // Important: Plugins have precedence over built-in plugins |
| 66 | func Load(pluginsDir string, l log.Logger) (plugins sdk.AvailablePlugins, err error) { |
| 67 | // Array of built-in plugins to enable which are loaded in host memory dynamically |
| 68 | toEnableBuiltIn := []sdk.FanOutFactory{ |
| 69 | dependencytrack.New, |
| 70 | smtp.New, |
| 71 | discord.New, |
| 72 | guac.New, |
| 73 | slack.New, |
| 74 | webhook.New, |
| 75 | } |
| 76 | |
| 77 | // Load plugins in memory from the array above |
| 78 | memLoader := &memoryLoader{plugins: toEnableBuiltIn, logger: l} |
| 79 | |
| 80 | logger := servicelogger.ScopedHelper(l, "plugins") |
| 81 | // Load plugins from a directory |
| 82 | dirLoader := &directoryLoader{ |
| 83 | pluginsDir: pluginsDir, |
| 84 | initializer: &goPluginInitializer{}, |
| 85 | logger: logger, |
| 86 | } |
| 87 | |
| 88 | return doLoad(memLoader, dirLoader, logger) |
| 89 | } |
| 90 | |
| 91 | func doLoad(memoryLoader pluginsLoader, dirLoader pluginsLoader, logger *log.Helper) (plugins sdk.AvailablePlugins, err error) { |
| 92 | defer func() { |
no test coverage detected