use of com.netflix.titus.gateway.startup.TitusGatewayModule in project titus-control-plane by Netflix.
the class EmbeddedTitusGateway method boot.
public EmbeddedTitusGateway boot() {
Stopwatch timer = Stopwatch.createStarted();
logger.info("Starting Titus Gateway");
injector = InjectorBuilder.fromModules(newJettyModule(), new ArchaiusModule() {
@Override
protected void configureArchaius() {
config.setProperty("titus.masterClient.masterIp", masterGrpcHost);
if (embeddedTitusMaster == null) {
config.setProperty("titus.masterClient.masterGrpcPort", masterGrpcPort);
config.setProperty("titus.masterClient.masterHttpPort", masterHttpPort);
} else {
// In the embedded mode, master cannot run jetty, so we set only GRPC port.
config.setProperty("titus.masterClient.masterGrpcPort", embeddedTitusMaster.getGrpcPort());
config.setProperty("titus.masterClient.masterHttpPort", "0");
}
bindApplicationConfigurationOverride().toInstance(config);
}
}, Modules.override(new TitusGatewayModule(enableREST)).with(new AbstractModule() {
@Override
protected void configure() {
if (store != null) {
bind(JobStore.class).toInstance(store);
}
bind(new TypeLiteral<AdmissionValidator<JobDescriptor>>() {
}).toInstance(validator);
}
@Provides
@Singleton
public AdmissionSanitizer<JobDescriptor> getJobSanitizer(TitusValidatorConfiguration configuration) {
return new AggregatingSanitizer(configuration, Collections.singletonList(jobSanitizer));
}
})).createInjector();
logger.info("Embedded TitusGateway started in {}ms", timer.elapsed(TimeUnit.MILLISECONDS));
return this;
}
Aggregations