mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-24 13:19:02 +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.
35 lines
1.1 KiB
Java
35 lines
1.1 KiB
Java
package nu.marginalia.api;
|
|
|
|
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;
|
|
|
|
public class ApiMain extends MainClass {
|
|
|
|
@Inject
|
|
public ApiMain(ApiService service) {
|
|
}
|
|
|
|
public static void main(String... args) {
|
|
init(ServiceId.Api, args);
|
|
|
|
Injector injector = Guice.createInjector(
|
|
new DatabaseModule(false),
|
|
new ServiceDiscoveryModule(),
|
|
new ServiceConfigurationModule(ServiceId.Api));
|
|
|
|
// Ensure that the service registry is initialized early
|
|
injector.getInstance(ServiceRegistryIf.class);
|
|
|
|
injector.getInstance(ApiMain.class);
|
|
injector.getInstance(Initialization.class).setReady();
|
|
}
|
|
}
|