Git Product home page Git Product logo

Comments (6)

ekrich avatar ekrich commented on May 20, 2024

Thank-you for trying out the library. Sorry you are not finding the library working as expected. I am not much of an expert on using the library so if you could provide some minimized code so I could test it out that would really help.

Another option is to try the lightbend config library with the JVM to see if it works in that environment. I have not been able to follow all the changes they have made so it could be fixed in that library but not this one.

from sconfig.

markehammons avatar markehammons commented on May 20, 2024
env=local
basedOnEnv=${env}

This is a minimal example. Loaded with

  val config2 = {
    ConfigFactory
      .parseString(
        new String(
          Files.readAllBytes(filesPath.resolve("parameters_base.conf"))
        )
      )
      .resolve()
  }

  println(config2.getString("basedOnEnv"))

Stack trace is:

org.ekrich.config.ConfigException$NotResolved: need to Config#resolve(), see the API docs for Config#resolve(); substitution not resolved: ConfigReference(${env})
        at java.lang.Throwable.fillInStackTrace(Unknown Source)
        at org.ekrich.config.impl.ConfigReference.notResolved(Unknown Source)
        at org.ekrich.config.impl.ConfigReference.valueType(Unknown Source)
        at org.ekrich.config.impl.ConfigReference.valueType(Unknown Source)
        at org.ekrich.config.impl.AbstractConfigValue.equals(Unknown Source)
        at java.util.Objects$.equals(Unknown Source)
        at java.util.AbstractCollection.$anonfun$contains$1(Unknown Source)
        at java.util.AbstractCollection$$Lambda$1.apply(Unknown Source)
        at java.util.ScalaOps$JavaIteratorOps$.exists$extension(Unknown Source)
        at java.util.ScalaOps$JavaIterableOps$.exists$extension(Unknown Source)
        at java.util.AbstractCollection.contains(Unknown Source)
        at java.util.Collections$WrappedCollection.contains(Unknown Source)
        at java.util.Collections$$anon$22.contains(Unknown Source)
        at org.ekrich.config.impl.ResolveContext.realResolve(Unknown Source)
        at org.ekrich.config.impl.ResolveContext.resolve(Unknown Source)
        at org.ekrich.config.impl.ConfigReference.resolveSubstitutions(Unknown Source)
        at org.ekrich.config.impl.ResolveContext.realResolve(Unknown Source)
        at org.ekrich.config.impl.ResolveContext.resolve(Unknown Source)
        at org.ekrich.config.impl.SimpleConfigObject$ResolveModifier.modifyChildMayThrow(Unknown Source)
        at org.ekrich.config.impl.SimpleConfigObject.$anonfun$modifyMayThrow$1(Unknown Source)
        at org.ekrich.config.impl.SimpleConfigObject$$Lambda$7.apply(Unknown Source)
        at scala.collection.IterableOnceOps.foreach(Unknown Source)
        at scala.collection.AbstractIterable.foreach(Unknown Source)
        at org.ekrich.config.impl.SimpleConfigObject.modifyMayThrow(Unknown Source)
        at org.ekrich.config.impl.SimpleConfigObject.resolveSubstitutions(Unknown Source)
        at org.ekrich.config.impl.ResolveContext.realResolve(Unknown Source)
        at org.ekrich.config.impl.ResolveContext.resolve(Unknown Source)
        at org.ekrich.config.impl.ResolveContext$.resolve(Unknown Source)
        at org.ekrich.config.impl.SimpleConfig.resolveWith(Unknown Source)
        at org.ekrich.config.impl.SimpleConfig.resolve(Unknown Source)
        at org.ekrich.config.impl.SimpleConfig.resolve(Unknown Source)
        at ops.environments.Local$.<init>(Unknown Source)
        at <none>._SM23ops.environments.Local$G4load(Unknown Source)
        at ops.environments.package$.<init>(Unknown Source)
        at <none>._SM25ops.environments.package$G4load(Unknown Source)
        at ops.Ops$.<init>(Unknown Source)
        at <none>._SM8ops.Ops$G4load(Unknown Source)
        at <none>.main(Unknown Source)
        at <none>.__libc_start_main(Unknown Source)
        at <none>._start(Unknown Source)

Another option is to try the lightbend config library with the JVM to see if it works in that environment. I have not been able to follow all the changes they have made so it could be fixed in that library but not this one.

I can try that tomorrow if you'd like, but I imagine resolving works there

from sconfig.

ekrich avatar ekrich commented on May 20, 2024

@markehammons Update: while porting tests to Scala Native, I ran across this that failed only only Scala Native.

[error] Test org.ekrich.config.impl.PropertiesTest.makeListWithNumericKeysAndMerge failed: org.ekrich.config.ConfigException$UnresolvedSubstitution: String: 5: Could not resolve substitution to a value: ${a} was part of a cycle of substitutions involving ${a}, ${a}, took 0.004 sec

from sconfig.

ekrich avatar ekrich commented on May 20, 2024

@markehammons If you are following, I determined the issue. java.util.IdentityHashMap needed fixing on Scala Native. Luckily I created a good version on Scala.js that I could port over. I put in a pull request there. scala-native/scala-native#2425

We will have to wait for a new release of Scala Native and then this PR where I extend the code coverage can be merged and then we can release another version of sconfig. Kind of a long path but good either way. #205

from sconfig.

markehammons avatar markehammons commented on May 20, 2024

from sconfig.

ekrich avatar ekrich commented on May 20, 2024

Closed via this PR: #205

So using Scala Native 0.4.2 and sconfig 1.4.6 should resolve the issue.

from sconfig.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.