Is it possible to define standalone mode jar option name
alswl opened this issue · comments
For current version of skinny, standalone mode jar starts with options like this skinny.port
etc.
Is it possible replace skinny.port
by spring.port
?
Because in my use case, I must use a PaaS platform only support start app with Spring Boot (or Node.js).
Thanks.
Having your own JettyLauncher
like this should work:
package your.domain.skinny.standalone
object JettyLauncher extends JettyServer {
def main(args: Array[String]): Unit = {
this.port(sys.props.get(spring.port)) // call setter method beforehand
run()
}
}
- https://github.com/skinny-framework/skinny-micro/blob/2.0.1/micro-server/src/main/scala/skinny/standalone/JettyLauncher.scala#L6
- https://github.com/skinny-framework/skinny-micro/blob/2.0.1/micro-server/src/main/scala/skinny/standalone/JettyServer.scala#L65-L68
- https://github.com/skinny-framework/skinny-micro/blob/2.0.1/micro-server/src/main/scala/skinny/standalone/JettyServer.scala#L22-L25
Then, modify mainClass in assembly
manually:
Thanks for you reply.
Another question: is it possible to rename app.profile
or skinny.profile
in standalone jar option.
I found modify this configuration is hard, skinny.micro.base.EnvAccessor
is extends with SkinnyMicroBase
and it cannot to be modified.
I found a solution:
System.setProperty("skinny.profile", System.getProperty("spring.profiles.active"))
After modified assembly
in skinny
, the packaged fatjar is always launch in skinny.standalone.JettyLauncher
.
I unzip the fat jar and found the MANIFEST.MF
Main-Class: skinny.standalone.JettyLauncher
Soloved: should remove project/_skinny_assembly.sbt
, then run ./skinny package:standalone