本文介绍了播放框架:为什么https url在使用"sbt dist"时无法正常工作?命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用play framework sbt dist命令创建用于部署Web应用程序的可执行文件.当我使用"sbt run"命令运行应用程序时,https可以工作,但是当我使用sbt dist运行可执行文件来启动我的应用程序时,则只有http url可以工作.

I am trying to create executable file for deploying my web app using play framework sbt dist command. When I run my application using "sbt run" command then https work but when I use sbt dist and run my executable file to start my app then only http url works.

以下是我的配置

在build.sbt中

In build.sbt

javaOptions ++= Seq(
  "-Dhttps.keyStore=conf/keystore.jks",
  "-Dhttps.keyStorePassword=*****",
  "-Dhttp.port=9000",
  "-Dhttps.port=9001",
  "-Dsentry.dsn=https://****"
)

在application.conf中

In application.conf

play.http {

  session {
    secure = true
    httpOnly = true
    domain = "localhost"
  }

  flash {
    secure = true
    httpOnly = true
  }
}

play.ws {
  ssl {
    trustManager = {
      stores = [
        { type = "JKS", path = "conf/keystore.jks" }
      ]
    }
  }
}

推荐答案

您需要在Universal中定义javaOptions:

javaOptions in Universal ++= Seq(
  "-Dhttps.keyStore=conf/keystore.jks",
  "-Dhttps.keyStorePassword=*****",
  "-Dhttp.port=9000",
  "-Dhttps.port=9001",
  "-Dsentry.dsn=https://****"
)

请参见 https: //www.scala-sbt.org/sbt-native-packager/archetypes/java_app/customize.html#via-build-sbt

但是,为什么不只在conf/application.conf中定义这些设置呢?

However, why not just define those settings in conf/application.conf?

这篇关于播放框架:为什么https url在使用"sbt dist"时无法正常工作?命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 14:25