Comments (6)
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.
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.
@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.
@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.
from sconfig.
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)
- Additional scala-friendly helpers? HOT 1
- Use more standard cross version code and directories HOT 1
- Fix Auto-application and eta-expanded errors for Scala 3 HOT 1
- Replace spray-json fork with something for longer term
- Avoid using collection-compat on 2.13+ HOT 1
- Can't link on scala-native 0.4.0 HOT 2
- Pick a versioning scheme
- Array is allocated but not used in PathParser HOT 1
- Add Java 17 to CI HOT 1
- ConfigFactory.load(conf) not implemented for Scala Native. HOT 1
- Upgrade scalafmt to support Scala 3 and add to CI HOT 1
- Revert Java 11+ workaround for Character.toString(0) once upstream is resolved
- Recent scalafmt split javadoc style @link across lines HOT 1
- Drop scala-collection-compat special logic
- Avoid the use of Class#newInstance, which is deprecated in Java 9
- Potential excess memory use with getDuration
- Port potential open commits
- Enhance Scala Native docs
- Update Dotty support for Scala.js
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sconfig.