You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In python i was able to do this but it doesn't really resolve in a 'join' operation and more like a union operation.
Maybe i could take the keys out of the the application and then filter it out of the resolved config.
conf: ConfigTree= ConfigFactory.parse_file("common.conf")
conf2: ConfigTree= ConfigFactory.parse_file("application.conf",resolve=False)
keys = conf2.keys()
resolved = conf2.with_fallback("application.conf")
// result:
// kafka.url = localhost:9092
// some-other-config = "i should not be here"
The text was updated successfully, but these errors were encountered:
borissmidt
changed the title
Config isn't lazy as the java version of the library
No resolveWith funtion as the java lib
Jun 25, 2021
a merge type parameter seems to be able to resolve that:
defmerge_configs(a, b, copy_trees=False, union_merge=True):
"""Merge config b into a :param a: target config :type a: ConfigTree :param b: source config :type b: ConfigTree :return: merged config a """forkey, valueinb.items():
ifunion_mergeorkeyina:
# if key is in both a and b and both values are dictionary then merge it otherwise override itifkeyinaandisinstance(a[key], ConfigTree) andisinstance(b[key], ConfigTree):
ifcopy_trees:
a[key] =a[key].copy()
merge_configs(a[key], b[key], copy_trees=copy_trees, union_merge=union_merge)
else:
ifisinstance(value, ConfigValues):
value.parent=avalue.key=keyifkeyina:
value.overriden_value=a[key]
a[key] =valueifa.root:
ifb.root:
a.history[key] =a.history.get(key, []) +b.history.get(key, [value])
else:
a.history[key] =a.history.get(key, []) + [value]
returna
I couldn't find any feature that would give me the same behavior as the java resolveWith function.
and another config
In python i was able to do this but it doesn't really resolve in a 'join' operation and more like a union operation.
Maybe i could take the keys out of the the
application
and then filter it out of the resolved config.The text was updated successfully, but these errors were encountered: