You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
721 B
36 lines
721 B
7 years ago
|
package com.xsn.explorer.config
|
||
|
|
||
|
import javax.inject.Inject
|
||
|
|
||
|
import play.api.Configuration
|
||
|
|
||
|
trait RPCConfig {
|
||
|
|
||
|
import RPCConfig._
|
||
|
|
||
|
def host: Host
|
||
|
def username: Username
|
||
|
def password: Password
|
||
|
}
|
||
|
|
||
|
object RPCConfig {
|
||
|
|
||
|
case class Host(string: String) extends AnyVal
|
||
|
case class Username(string: String) extends AnyVal
|
||
|
case class Password(string: String) extends AnyVal
|
||
|
}
|
||
|
|
||
|
class PlayRPCConfig @Inject() (config: Configuration) extends RPCConfig {
|
||
|
|
||
|
import RPCConfig._
|
||
|
|
||
|
private def get(name: String) = config.get[String](s"rpc.$name")
|
||
|
|
||
|
override val host: Host = Host(get("host"))
|
||
|
|
||
|
override def username: Username = Username(get("username"))
|
||
|
|
||
|
override def password: Password = Password(get("password"))
|
||
|
|
||
|
}
|