On reading Pragmatic Programmer, the authors recommend that we wrap configuration information behind a thin API as it decouples the details of the representation of the configuration.
Quote from the book about Configuration.
Commonly, this data structure is made global, the thinking being that this makes it easier for any part of the code to get to the values it holds. We prefer that you don't do that. Instead wrap the configuration information behind a (thin) API. This decouples your code from the details of the representation of the configuration.
I am not sure how that decouples the details of the representation of the configuration. For example, If I have a javascript object that stores a configuration value, the client could access the configuration value via object.<someConfigKey>. Wouldn't wrapping this configuration value inside an object result in the client calling something like config.<getSomeConfigKey>() ?
Since configuration objects are usually represented as a data structure (I.e json like), how does wrapping configuration information behind a thin API result in decoupling ?