mirror of https://github.com/zlatinb/muwire
store properties on startup
parent
ee8c39f032
commit
8ea6ecdea9
|
@ -48,11 +48,14 @@ class Core {
|
|||
propsFile.withInputStream {
|
||||
props.load(it)
|
||||
}
|
||||
} else
|
||||
props = new MuWireSettings(props)
|
||||
} else {
|
||||
log.info("creating default properties")
|
||||
|
||||
props = new MuWireSettings(props)
|
||||
|
||||
props = new MuWireSettings()
|
||||
propsFile.withOutputStream {
|
||||
props.write(it)
|
||||
}
|
||||
}
|
||||
|
||||
log.info("initializing I2P socket manager")
|
||||
def i2pClient = new I2PClientFactory().createClient()
|
||||
|
|
|
@ -4,7 +4,14 @@ import com.muwire.core.hostcache.CrawlerResponse
|
|||
|
||||
class MuWireSettings {
|
||||
|
||||
MuWireSettings() {}
|
||||
final boolean isLeaf
|
||||
boolean allowUntrusted
|
||||
String nickname
|
||||
CrawlerResponse crawlerResponse
|
||||
|
||||
MuWireSettings() {
|
||||
this(new Properties())
|
||||
}
|
||||
|
||||
MuWireSettings(Properties props) {
|
||||
isLeaf = Boolean.valueOf(props.get("leaf","false"))
|
||||
|
@ -13,10 +20,14 @@ class MuWireSettings {
|
|||
nickname = props.getProperty("nickname","MuWireUser")
|
||||
}
|
||||
|
||||
final boolean isLeaf
|
||||
boolean allowUntrusted
|
||||
String nickname
|
||||
CrawlerResponse crawlerResponse
|
||||
void write(OutputStream out) throws IOException {
|
||||
Properties props = new Properties()
|
||||
props.setProperty("leaf", isLeaf.toString())
|
||||
props.setProperty("allowUntrusted", allowUntrusted.toString())
|
||||
props.setProperty("crawlerResponse", crawlerResponse.toString())
|
||||
props.setProperty("nickname", nickname)
|
||||
props.store(out, "")
|
||||
}
|
||||
|
||||
boolean isLeaf() {
|
||||
isLeaf
|
||||
|
|
Loading…
Reference in New Issue