mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-24 21:29:00 +00:00

This is necessary as we use zookeeper to orchestrate first-time startup of the services, to ensure that the database is properly migrated by the control service before anything else is permitted to start.
44 lines
1.3 KiB
Java
44 lines
1.3 KiB
Java
package nu.marginalia.search;
|
|
|
|
import com.google.inject.Guice;
|
|
import com.google.inject.Inject;
|
|
import com.google.inject.Injector;
|
|
import nu.marginalia.service.MainClass;
|
|
import nu.marginalia.service.discovery.ServiceRegistryIf;
|
|
import nu.marginalia.service.module.ServiceDiscoveryModule;
|
|
import nu.marginalia.service.ServiceId;
|
|
import nu.marginalia.service.module.ServiceConfigurationModule;
|
|
import nu.marginalia.service.module.DatabaseModule;
|
|
import nu.marginalia.service.server.Initialization;
|
|
import spark.Spark;
|
|
|
|
public class SearchMain extends MainClass {
|
|
private final SearchService service;
|
|
|
|
@Inject
|
|
public SearchMain(SearchService service) {
|
|
this.service = service;
|
|
}
|
|
|
|
public static void main(String... args) {
|
|
|
|
init(ServiceId.Search, args);
|
|
|
|
Spark.staticFileLocation("/static/search/");
|
|
|
|
Injector injector = Guice.createInjector(
|
|
new SearchModule(),
|
|
new ServiceConfigurationModule(ServiceId.Search),
|
|
new ServiceDiscoveryModule(),
|
|
new DatabaseModule(false)
|
|
);
|
|
|
|
// Ensure that the service registry is initialized early
|
|
injector.getInstance(ServiceRegistryIf.class);
|
|
|
|
injector.getInstance(SearchMain.class);
|
|
injector.getInstance(Initialization.class).setReady();
|
|
|
|
}
|
|
}
|