Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a standard location for Typesafe Config file in a project directory structure?

I'm a newbie to Scala and the JVM.

I've created a project via Typesafe Activator, and I'm adding configuration to it using Typesafe Config.

The documentation for Typesafe Config says that I can put the config file anywhere on the classpath under a number of different names.

Is there a standard location for each of these files?

I am also unfamiliar with determining or modifying the classpath for such a project, but that may be a separate question.

EDIT: Here is the directory structure

/home/d/projects/test/minimal-scala1/
▸ lib/
▸ project/
▾ src/
  ▾ main/
▸ scala/
  ▸ test/
▸ target/
  activator*
  activator-launch-1.2.3.jar
  activator-sbt-echo-akka-shim.sbt
  activator.bat*
  build.sbt
  LICENSE
like image 616
David Avatar asked Jan 10 '23 16:01

David


1 Answers

Short Answer

If you are developing a third party lib to be used by other projects

src/main/resources/reference.conf

If you are developing a regular application

src/main/resources/application.conf

Long Answer

  • system properties
    Not a file obviously. You can specify them on command line when starting the app
    sbt -Dmy.property=value run
  • application.conf
    src/main/resources/application.conf
  • application.json
    src/main/resources/application.json
    Note: .conf format is more commonly used, you can skip this file.
  • application.properties
    src/main/resources/application.properties
    Note: .conf format is more commonly used, you can skip this file.
  • reference.conf
    src/main/resources/reference.conf
    Note: Although it is meant to be provided by third party libs, but nothing prevents you from using the file in regular applications.
like image 153
tabdulradi Avatar answered Jan 23 '23 06:01

tabdulradi