Skip to content

conf: enable dependency injection of site-config accessing to reduce use of global accessors

Administrator requested to merge nsc/less-global-conf into main

Created by: Strum355

This PR primarily introduces these changes:

  1. Creates SiteConfig() and ServiceConnections() methods on internal/conf.(*client) and internal/conf.Unified
  2. Creates commonly-used interfaces for (a subset of) the methods of internal/conf.(*client) and for internal/conf.Unified
  3. Makes internal/conf.(*client) a type designed to be passed around by exporting internal/conf.DefaultClient() a. This reduces the reliance on the internal/conf package which has reliance on other widely used packages, instead shifting the reliance onto the (almost) interface-only internal/conf/conftypes b. It is expected that a config-type interface from point 2 is passed down the stacks rather than relying on the global internal/conf.Get()
  4. Replaces use of internal/conf.Get() with calls to a passed-down internal/conf.(*client) in a select few areas. a. Other teams can adopt this at their own pace and to the extent they see suitable

This pattern should also allow for moving away from the existing format of mocking site-config once adoption is far enough.

NOTE: all names are subject to change. Please leave your name recommendations if you'd prefer different names.

Merge request reports

Loading