Skip to content

Commit

Permalink
Fix resolution of references
Browse files Browse the repository at this point in the history
Resolve failed with the following exception when using references:
Exception in thread "main" com.typesafe.config.ConfigException$BugOrBroken: replace in parent not possible

The docs for resolveWith says:
> Note that this method does NOT look in this instance for substitution values.

Which means we can't refer to variabled in the same config.
It also says:
> If you want to do that, you could either merge this instance into
> your value source using Config.withFallback,  or you could resolve
> multiple times with multiple sources (using setAllowUnresolved).

I tried using withFallback, but the same error still occurred.
This might be due to a bug in typesafe config:
lightbend/config#332

This works around that by resolving multiple times as suggested
in the javadoc.
  • Loading branch information
henrikno committed Mar 9, 2020
1 parent 255e7c2 commit decadc0
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/main/java/com/github/okapies/hoc2js/Hoc2Js.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public static void main(String[] args) {

// resolve
ConfigResolveOptions resolveOpts = loadResolveOpts(config);
obj = obj.resolve(resolveOpts.setAllowUnresolved(true));
obj = obj.resolveWith(config, resolveOpts);

// render
Expand Down

0 comments on commit decadc0

Please sign in to comment.