Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

akka 工程如何打包时,依赖外部conf配置文件 #7

Open
He-Pin opened this issue Jan 24, 2016 · 0 comments
Open

akka 工程如何打包时,依赖外部conf配置文件 #7

He-Pin opened this issue Jan 24, 2016 · 0 comments

Comments

@He-Pin
Copy link
Member

He-Pin commented Jan 24, 2016

问题:
我们有时候需要灵活的修改配置文件,以适应线上环境。通过sbt,我们可以轻松实现这点。

办法:

mappings in Universal ++= contentOf((resourceDirectory in Compile).value).map{
  case (file,path)=>
    file -> ("conf/" + path)
}

scriptClasspath := "../conf/" +: scriptClasspath.value

mappings in Universal += baseDirectory.value / "src/main/resources/reference.conf" -> "conf/application.conf"

通过这样,我们将${user.dir}/conf/application.conf加入到classpath中,根据Typesafe config的配置,其会覆盖内部的reference.conf。这样我们就可以在线上环境中做相应的调整了。

@He-Pin He-Pin changed the title akka工程如何打包时,依赖外部conf配置文件 akka 工程如何打包时,依赖外部conf配置文件 Jan 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant