Application.conf by subproject


(Kai Matsuda) #1

Hi!
Is it possible to split application.conf logic based on the submodule? I have some content security policy headers that I want to set for a service and not the others.

Currently my build.sbt:

name := """server"""

scalaVersion := "2.12.6"

libraryDependencies ++= {
  Seq(
    guice,
    "org.scalatestplus.play" %% "scalatestplus-play" % "3.1.2" % Test
  )
}

lazy val web = (project in file("modules/web")).enablePlugins(PlayScala)

lazy val main = (project in file(".")).enablePlugins(PlayScala).dependsOn(web).aggregate(web)

My conf/application.conf is empty.

And I have the following for my modules/web/conf/web.conf:

# Content Security Policy (https://www.html5rocks.com/en/tutorials/security/content-security-policy/)
play.filters.headers.contentSecurityPolicy = "style-src 'self' https://stackpath.bootstrapcdn.com"
play.filters.headers.contentSecurityPolicy = "style-src 'self' https://fonts.googleapis.com"
play.filters.headers.contentSecurityPolicy = "font-src 'self' https://fonts.googleapis.com"
play.filters.headers.contentSecurityPolicy = "script-src 'self' https://unpkg.com"

Currently when I run the server it only seems to be reading from my conf/application.conf file.

Thanks!