0

I have a Typesafe config file (application.conf). I want to override some settings with system environment variables (like in Overriding configuration with environment variables in typesafe config), but I would like to do some modifications to the value in the environment variable (ex. toLowerCase, replace('\', '/'), split("/"))

So I had something like this:

# C:\Users\...\project_root\sub_project\src\main\resources\application.conf

foo = {
  bar = "baz"
}

And I change it to this:

foo = {
  bar = "baz"
  bar = ${?FOO}
}

But now I want to do this:

foo = {
  bar = "baz"
  bar = ${?FOO.toLowerCase}
}

When I run sbt update on my project the Typesafe Config dependency I have is this:

[info] Resolving com.typesafe#config;1.2.1 ...
Michael Lafayette
  • 2,972
  • 3
  • 20
  • 54

1 Answers1

0

Rather than accessing typesafe config directly, you should probably define an interface of sorts in your project's util module and access your config through that interface. That way you have one centralized place to get your config and that centralized place can provide additional functionality on top of the basic storing and getting of config values. In addition, you can use a library that sits in front of typesafe config and access the values through that library.

Michael Lafayette
  • 2,972
  • 3
  • 20
  • 54