use of io.dropwizard.db.DataSourceFactory in project keywhiz by square.
the class ServiceDataSourceModule method dataSource.
@Provides
@Singleton
ManagedDataSource dataSource(Environment environment, KeywhizConfig config) {
DataSourceFactory dataSourceFactory = config.getDataSourceFactory();
ManagedDataSource dataSource = dataSourceFactory.build(environment.metrics(), "db-writable");
environment.lifecycle().manage(dataSource);
environment.healthChecks().register("db-read-write-health", new JooqHealthCheck(dataSource, LOG_ONLY));
return dataSource;
}
Aggregations