Honor --slave and --headless options better

Looks like serving PolyGerrit UI never honored the --headless option.
In addition, the StaticModule was unnecessarily installed when running
in the slave mode.

Don't install the StaticModule when running in the slave mode.
Don't serve PolyGerrit UI when running in the headless mode.

Change-Id: I480a9c33d596feba4516028491684832785b8dc4
This commit is contained in:
Saša Živkov 2018-11-16 14:56:30 +01:00
parent ba0639b379
commit 90719e2ac6
3 changed files with 9 additions and 4 deletions

View File

@ -443,7 +443,10 @@ public class WebAppInitializer extends GuiceServletContextListener implements Fi
modules.add(sysInjector.getInstance(GetUserFilter.Module.class)); modules.add(sysInjector.getInstance(GetUserFilter.Module.class));
// StaticModule contains a "/*" wildcard, place it last. // StaticModule contains a "/*" wildcard, place it last.
GerritOptions opts = sysInjector.getInstance(GerritOptions.class);
if (opts.enableMasterFeatures()) {
modules.add(sysInjector.getInstance(StaticModule.class)); modules.add(sysInjector.getInstance(StaticModule.class));
}
return sysInjector.createChildInjector(modules); return sysInjector.createChildInjector(modules);
} }

View File

@ -137,10 +137,9 @@ public class StaticModule extends ServletModule {
}); });
if (!options.headless()) { if (!options.headless()) {
install(new CoreStaticModule()); install(new CoreStaticModule());
}
install(new PolyGerritModule()); install(new PolyGerritModule());
} }
}
@Provides @Provides
@Singleton @Singleton

View File

@ -611,7 +611,10 @@ public class Daemon extends SiteProgram {
modules.add(sysInjector.getInstance(GetUserFilter.Module.class)); modules.add(sysInjector.getInstance(GetUserFilter.Module.class));
// StaticModule contains a "/*" wildcard, place it last. // StaticModule contains a "/*" wildcard, place it last.
GerritOptions opts = sysInjector.getInstance(GerritOptions.class);
if (opts.enableMasterFeatures()) {
modules.add(sysInjector.getInstance(StaticModule.class)); modules.add(sysInjector.getInstance(StaticModule.class));
}
return sysInjector.createChildInjector(modules); return sysInjector.createChildInjector(modules);
} }