mirror of https://github.com/reiseburo/offtopic
27 lines
761 B
Groovy
27 lines
761 B
Groovy
package offtopic
|
|
|
|
import groovy.util.logging.Slf4j
|
|
|
|
/**
|
|
* class for wrapping our system configuration
|
|
*/
|
|
@Singleton
|
|
@Slf4j
|
|
class Configuration extends Properties {
|
|
static final String DEFAULT_ZOOKEEPERS = 'localhost:2181'
|
|
/**
|
|
* Load defaults, starting in the current working directory, searching for
|
|
* 'offtopic.properties'
|
|
*/
|
|
public boolean loadDefaults() {
|
|
File cwdConfiguration = new File('offtopic.properties')
|
|
if (cwdConfiguration.exists()) {
|
|
log.info('Loading `offtopic.properties` for configuration')
|
|
this.load(new FileInputStream(cwdConfiguration))
|
|
}
|
|
else {
|
|
log.warn('Could not load configuration file {}', cwdConfiguration.absolutePath)
|
|
}
|
|
}
|
|
}
|