Utility library to assist in providing default config properties to dropwizard services
- Add the Maven dependency (available in Maven Central)
<dependency>
<groupId>org.kiwiproject</groupId>
<artifactId>dropwizard-config-providers</artifactId>
<version>[latest-version]</version>
</dependency>
- Add the following to your Configuration class:
public class YourConfiguration extends Configuration {
private String serviceName = ServiceIdentityProvider.builder().build().getName();
}
The service providers will resolve properties in the following order:
- System property with the given system property key
- System property with the default system property key (See the specific provider for details)
- Environment variable with the given variable name
- Environment variable with the default variable name (See the specific provider for details)
- An explicit value
- The value from an external configuration file with the given key (See ExternalPropertyProvider for details)
- The value from an external configuration file with the default key (See the specific provider for details)
- The value from a given supplier
The following providers are currently available in this library.
Provider | Description | Properties Resolved |
---|---|---|
ActiveMQConfigProvider | Resolves the connection string for ActiveMQ servers | activeMQServers |
DropwizardDataSourceConfigProvider | Resolves a DataSourceFactory for connecting to a relational database in Dropwizard | dataSourceFactory |
ElkLoggerConfigProvider | Resolves the connection and configuration information for an ELK Logger server | host, port, customFields |
ElucidationConfigProvider | Resolves the connection and configuration for an Elucidation server | host, port, enabled |
HibernateConfigProvider | Resolves default properties for a Hibernate connection | hibernateProperties |
MongoConfigProvider | Resolves the connection string for Mongo servers | url |
NetworkIdentityConfigProvider | Resolves a named network, useful if you want to have services run in different subnets/VPCs | network |
ServiceIdentityConfigProvider | Resolves identity information for a running service | name, version, environment (deployed) |
TlsConfigProvider | Resolves the properties to use in a TLS Configuration | tlsContextConfiguration |
SharedStorageConfigProvider | Resolves a directory path that will be used for shared storage between services | sharedStoragePath |
ZooKeeperConfigProvider | Resolves the ZooKeeper connection string | connectString |
Custom providers can be created by extending the ConfigProvider
interface. Also, the existing providers can be extended by setting various lookup mechanisms
listed in the order of precedence section.