Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 20 13:04
    patriknw milestoned #167
  • Aug 20 13:03
    patriknw commented #619
  • Aug 20 13:02

    patriknw on master

    Allow application.conf to overr… (compare)

  • Aug 20 13:02
    patriknw closed #619
  • Aug 16 14:55
    havocp commented #494
  • Aug 16 14:26
    pablolagreca commented #494
  • Aug 13 14:53
    andreitaleanu commented #647
  • Aug 13 13:07
    havocp labeled #647
  • Aug 13 13:07
    havocp labeled #647
  • Aug 13 13:06
    havocp commented #647
  • Aug 13 11:34
    andreitaleanu opened #647
  • Aug 12 09:15
    misiekzap commented #592
  • Aug 06 14:41
    mvallebr commented #332
  • Aug 06 14:40
    mvallebr commented #332
  • Jul 30 02:18
    HaleyWang opened #646
  • Jul 29 05:28
    jroper commented #619
  • Jul 29 05:28
    jroper synchronize #619
  • Jul 26 13:32
    havocp closed #645
  • Jul 26 13:32
    havocp commented #645
  • Jul 26 13:20
    Buckstabue opened #645
Martynas Mickevičius
@2m
@/all 1.3.4 has just been released and artifacts are on their way to Maven Central! https://github.com/lightbend/config/blob/master/NEWS.md#134-april-18-2018
Havoc Pennington
@havocp
woooo! thank you!
Andrea Peruffo
@andreaTP
YaY! Thanks!
roded
@roded
Hi, I'm trying to use build my own error messages for config validation. Is it possible to get more detailed info regarding missing/invalid key exceptions? The various ConfigException sub-classes do not retain the path or types data it seems. Cheers
dvirf
@dvirf
@roded If you are using Scala, you can use pureconfig, which will "class up" your reference.conffile (to a case class)
roded
@roded
@dvirf, thanks for the reply, we're using Java though. Will Lightbend/config accept a PR to add such information to the ConfigException.WrongType exception?
Havoc Pennington
@havocp
if it works out fairly simple and backward compatible seems ok. if it exposes internals from impl package or breaks ABI or adds a lot of new API then maybe not worth it.
roded
@roded
Thanks @havocp, we'll look into it.
Eric K Richardson
@ekrich
@havocp It looks like config is now working on JDK11? - lightbend/config#632 I am wondering about the test that was previously failing with the JDK system properties java.version and java.version.date. Did something change in the JDK?
Seth Lasky
@TheMover
Hey all. I call ConfigFactory.load() in one of my methods and I'm trying to just use a quick and dirty System.setProperty in my test to override the values I want to change before I call that method. This works if I run the test by itself but when I run my whole suite that tests always fails due to the property remaining the default value instead of the overridden. Has anyone experienced this?
Seth Lasky
@TheMover
Figured it out! ConfigFactory.invalidateCache() before calling the method works
Andrea Peruffo
@andreaTP
:-)
thanks again @havocp and @2m
Martynas Mickevičius
@2m
Thank you for implementing it. :)
Andrea Peruffo
@andreaTP
I'm still not done unfortunately ... just getting bothered by colleagues in the last days on hoe to encode lists in env variables :-S
I'm trying to think about a decent encoding and cannot come up with something that doesn't looks like a terrible hack :-S
Havoc Pennington
@havocp
there’s definitely some old discussion about lists on env vars if you do some issue archaeology. my favorite idea was an env var or two that contains a full HOCON document and can do arbitrary basket of values
Andrea Peruffo
@andreaTP
uhmmm, interesting but this will mean to enter into the escaping hell for sure, isn't it?
Havoc Pennington
@havocp
not real avoidable I don’t think. but in contexts where the env var value isn’t going through the shell it might not be so bad. Not sure how kubernetes or heroku escaping would work out
I mean, in some sense the real answer is env variables have a complexity ceiling where they just aren’t a good approach
Andrea Peruffo
@andreaTP
That's true
nshah99
@nshah99
Hi, we are using HOCON config format and one of our requirements is around assembled configs(one default with environment specific overrides) which is resolved by using includes. Currently though the includes are resolved at runtime. Is there a way for us to resolve the includes using some tool at build time so that users can see output of all of the includes ?
Andrea Peruffo
@andreaTP
since includes are resolved from env variables they have to be at runtime @nshah99
e.g. in your running environment you can have settings that are completely different from the development machine
nshah99
@nshah99
I assumed that the common case for providing includes(file("baseconfig.conf")) would be to allow for common base configs and overrides for env specific configs. Is that not the case ? I don't see the involvement of env variables in this case. Just a case of config DRY-ness.
@andreaTP ^^
Andrea Peruffo
@andreaTP
if the substitution is done only from the includes it's possible to get the output
I wouldn't trust it since it can be different at runtime (e.g. depending on classpath env overrides and whatever)
but if this is your case simply use typesafe-config from SBT and you will get an output
nshah99
@nshah99
any equivalents for gradle ?
truongio
@truongio

Hi, I'm trying to figure out if I can do named variable substitution during runtime. Example:

template.one = "Congratulations! You have bought ${title} for ${amount}"

and then in the Scala code I want to be able to do something in this fashion:

val map = Map("amount" -> "100", "title" -> "iPhone Xs") 
config.parseString("template.one", map)

Is this possible?

Andrea Peruffo
@andreaTP
@nshah99 typesafe-config is Java code, I assume you can import and use it in the build tool whatever it is
nshah99
@nshah99
@andreaTP sorry for ignorance here. I have defined the config file in HOCON format and I have taken dependency on lightbend/config lib to parse configs in code. But as part of build I want to resolve the includes of all the config files. Are you suggesting I write some code to resolve this using the config library and output that to some file ?
Andrea Peruffo
@andreaTP
yep it will be a build tool plugin or something, still I think it's a partial solution
Erik Erlandson
@erikerlandson
I wrote a blog post about adding unit types to lightbend/config:
http://erikerlandson.github.io/blog/2019/05/09/preventing-configuration-errors-with-unit-types/
Salil Kanetkar
@salilkanetkar
Hello,
I had a use case whereby I want to generate a random number/string in my .conf file. Is there a way to do that in typesafe?
Martynas Mickevičius
@2m
I would go for a source generator in SBT, or your build tool of choice, for that.
Eric K Richardson
@ekrich
What is the minimum code needed to resolve a substitution?
  val configStr =
      """
        |pattern.default.main = "default"
        |core = {
        |  version: "0.1"
        |  extends: [
        |    ${pattern_default_main}
        |  ]
        |}
    """.stripMargin

    val conf = ConfigFactory.parseString(configStr)
    println(conf.isResolved ) // false
    val rconf = conf.resolve()
Maciej Nowicki
@Vistritium

Hello, anyone knows any library that can parse typesafe config onto case class using runtime types?

def read(clazz: Class[_], config: com.typesafe.config.Config, path: String): AnyRef = {
    ??? // config.as(clazz, path)
}

clazz is a case class.

nafg
@nafg
@Vistritium wdym exactly by "runtime types"
maheswar4b4
@maheswar4b4
Hi,
I have application.conf which has the default config and
env specific config in another file. How do i specify multiple config files on the command line ?.
Martynas Mickevičius
@2m
@maheswar4b4 include the directory that has both of the config files to the classpath.
maheswar4b4
@maheswar4b4
@2m Yeah, That should work as well, but I want to minimize the config files. Here is what I have 1) application.conf 2) env specific file that has seed hosts and canonical hostname 3) another conf file that includes both the application.conf and env conf file. What I am looking for is there any way through which I can avoid the 3rd file that does nothing but includes #1 and #2 config files. Any system parameter through which I can specify multiple config files
Tim Moore
@TimMoore
@maheswar4b4 the more common thing would be to have the env-specific one as the top level config file that you specify with a system property on the command line, and then that includes application.conf
ahmad-shahzad-hut
@ahmad-shahzad-hut
Hi I have an issue. I have a value in my config file which I am trying to override when i exectute the jar. Like doing java -Dfoo.bar.value=5 -jar myJar.jar
but it does not overwrite the value defined in the conf file.
do you know if I am doing anything wrong.
Tim Moore
@TimMoore
@ahmad-shahzad-hut that seems like that should work, but to help you we would need more details (code examples, with exactly what you tried)
ahmad-shahzad-hut
@ahmad-shahzad-hut
thansk a lot. I have learnt that it matters the way a configuration file is loaded.
maheswar4b4
@maheswar4b4
hi, Is this supported ${key:-defaultValue} or something similar in config library ?
If key is set, return the value, else return the default value.
Havoc Pennington
@havocp
can set the key once to default and then on the next line set it to ${?override} which will only override if override is set ?