gurkankaymak / hocon

go implementation of lightbend's HOCON configuration library https://github.com/lightbend/config
MIT License
79 stars 17 forks source link

Export Object.toConfig #9

Closed kolstae closed 3 years ago

kolstae commented 3 years ago

This is useful when using a general config as fallback for one specific to the environment:

value1: abc
value2: def

prod {
   value2: ghi
}
config, err := hocon.ParseResource("application.conf")
envConf := config.GetObject("prod")
if envConf != nil {
   config = envConf.ToConfig().WithFallback(config)
}
codecov[bot] commented 3 years ago

Codecov Report

Merging #9 (429425f) into master (4593f05) will increase coverage by 0.35%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #9      +/-   ##
==========================================
+ Coverage   95.98%   96.34%   +0.35%     
==========================================
  Files           3        3              
  Lines         598      684      +86     
==========================================
+ Hits          574      659      +85     
- Misses         19       20       +1     
  Partials        5        5              
Impacted Files Coverage Δ
config.go 91.70% <100.00%> (+0.88%) :arrow_up:
errors.go 100.00% <0.00%> (ø)
parser.go 98.58% <0.00%> (+0.13%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 4593f05...429425f. Read the comment docs.