Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
openmole
openmole-connect
Commits
8a5ea175
Commit
8a5ea175
authored
Sep 25, 2019
by
Mathieu
Browse files
Remove useless port and publicAdress parameters
parent
463e4cb3
Changes
2
Hide whitespace changes
Inline
Side-by-side
application/src/main/scala/org/openmole-connect/application/Application.scala
View file @
8a5ea175
...
...
@@ -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
()
}
...
...
server/src/main/scala/org/openmole-connect/server/ConnectServer.scala
View file @
8a5ea175
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment