What about a case statement for that condition?

```scala
val RegisterTimeout = getString("register-timeout") match {
  case "infinite" => Duration.Undefined
  case x => Duration(x, MILLISECONDS)
}
```