Commit 8a5ea175 authored by Mathieu's avatar Mathieu
Browse files

Remove useless port and publicAdress parameters

parent 463e4cb3
......@@ -12,16 +12,12 @@ object Application extends App {
case class Config(
tokenSecret: String = "",
publicAdress: String = "",
port: Option[Int] = None,
launchMode: LaunchMode = ServerMode
)
def usage =
"""OpenMOLE-connect application options:
|[--secret secret] specify the keycloak secret
|[--public-adress url] public entry point for openmole instances
|[--port port] specify the port for openmole-manager application
"""
def parse(args: List[String], c: Config = Config()): Config = {
......@@ -29,8 +25,6 @@ object Application extends App {
else {
args match {
case "--secret" :: tail parse(tail.tail, c.copy(tokenSecret = tail.head))
case "--public-adress" :: tail parse(tail.tail, c.copy(publicAdress = tail.head))
case "--port" :: tail parse(tail.tail, c.copy(port = Some(tail.head.toInt)))
case "--help" :: tail => c.copy(launchMode = HelpMode)
case _ => c.copy(launchMode = HelpMode)
}
......@@ -40,13 +34,9 @@ object Application extends App {
val config = parse(args.toList, Config())
config.launchMode match {
case HelpMode
println(usage)
case HelpMode println(usage)
case ServerMode =>
val server = new ConnectServer(
port = config.port.getOrElse(8080),
secret = config.tokenSecret,
publicAdress = config.publicAdress)
val server = new ConnectServer(secret = config.tokenSecret)
server.start()
}
......
......@@ -12,7 +12,7 @@ import org.scalatra.servlet.ScalatraListener
object ConnectServer {
val servletArguments = "servletArguments"
case class ServletArguments(secret: String, publicAdress: String, resourceBase: java.io.File)
case class ServletArguments(secret: String, resourceBase: java.io.File)
}
......@@ -23,19 +23,19 @@ class ConnectBootstrap extends LifeCycle {
}
}
class ConnectServer(port: Int, secret: String, publicAdress: String) {
class ConnectServer(secret: String) {
def start() = {
val server = new Server()
val connector = new ServerConnector(server)
connector.setPort(port)
connector.setPort(8080)
server.addConnector(connector)
val startingContext = new WebAppContext()
startingContext.setResourceBase("application/target/webapp")
startingContext.setAttribute(ConnectServer.servletArguments, ConnectServer.ServletArguments(secret, publicAdress, new java.io.File(new URI(startingContext.getResourceBase))))
startingContext.setAttribute(ConnectServer.servletArguments, ConnectServer.ServletArguments(secret, new java.io.File(new URI(startingContext.getResourceBase))))
startingContext.setInitParameter(ScalatraListener.LifeCycleKey, classOf[ConnectBootstrap].getCanonicalName)
startingContext.setContextPath("/")
startingContext.addEventListener(new ScalatraListener)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment