def extractTunnelConfig()

in src/main/scala/com/gu/ssm/Logic.scala [35:45]


  def extractTunnelConfig(tunnelStr: String): Either[String, TunnelTargetWithHostName] = {
    tunnelStr.split(":").toList match {
      case localPortStr :: targetStr :: remotePortStr :: Nil =>
        (localPortStr.toIntOption, targetStr, remotePortStr.toIntOption) match {
          case (Some(localPort), targetStr, Some(remotePort)) =>
            Right(TunnelTargetWithHostName(localPort, targetStr, remotePort))
          case _ => Left(s"$tunnelValidationErrorMsg Ports must be integers.")
        }
      case _ => Left(tunnelValidationErrorMsg)
    }
  }