Search code examples
scalaplayframeworkconfigplayframework-2.2

Defining an array in play's config file


I didn't find any information about that topic. Is there any way to define an array in the standard play config file app.config which have such the values as?

application.secret="Gk<9kCgMu@A62eyfcJ;YZ2nFnA;4324/gfdg]afdsfds"
application.langs="en"
application.global=common.Global

Solution

  • Yes, it is possible and described in the Play configuration chapter.

    In general, what you are looking for is this:

    my.setting="[value1,value2,value3]"
    

    In your code you can access it like this:

    Play.current.configuration.getStringList("my.setting") //returns an Option[java.util.List[String]]
    

    You may also use getLongList, getBooleanList and so on.