Skip to content

Commit

Permalink
Don't load plugins when init.and.exit is enabled
Browse files Browse the repository at this point in the history
Plugins are not (yet) required for init tasks and thus don't need to be loaded.

Signed-off-by: nscuro <[email protected]>
  • Loading branch information
nscuro committed Sep 26, 2024
1 parent a3d83f7 commit 63482d2
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
*/
package org.dependencytrack.plugin;

import alpine.Config;
import alpine.common.logging.Logger;
import org.dependencytrack.common.ConfigKey;

import jakarta.servlet.ServletContextEvent;
import jakarta.servlet.ServletContextListener;

Expand All @@ -33,6 +36,12 @@ public class PluginInitializer implements ServletContextListener {

@Override
public void contextInitialized(final ServletContextEvent event) {
if (Config.getInstance().getPropertyAsBoolean(ConfigKey.INIT_AND_EXIT)) {
LOGGER.info("Not loading plugins because %s is enabled"
.formatted(ConfigKey.INIT_AND_EXIT.getPropertyName()));
return;
}

LOGGER.info("Loading plugins");
pluginManager.loadPlugins();
}
Expand Down

0 comments on commit 63482d2

Please sign in to comment.