IMO there is another level in between 3 and 4 where config file allows for cross referencing among config values, forming a graph.
foo.password = xxx
bar.password = yyy
wifi.ssid = foo