code: def _load_with_overrides(base) -> Dict[str, str]:
      
      should_write = False
      overrides = _get_environ_overrides()
      try:
          index = json.load((base/_CONFIG_FILENAME).open())
      except (OSError, json.JSONDecodeError) as e:
          sys.stderr.write("Error loading config from {}: {}\nRewriting...\n"
                           .format(str(base), e))
          should_write = True
          index = generate_config_index(overrides)
  
      for key in CONFIG_ELEMENTS:
          if key.name not in index:
              sys.stderr.write(
                  f"New config index key {key.name}={key.default}"
                  "\nRewriting...\n")
              if key.kind in (ConfigElementType.DIR, ConfigElementType.FILE):
                  index[key.name] = base/key.default
              else:
                  index[key.name] = key.default
              should_write = True
  
      if should_write:
          try:
              write_config(index, path=base)
          except Exception as e:
              sys.stderr.write(
                  "Error writing config to {}: {}\nProceeding memory-only\n"
                  .format(str(base), e))
      index.update(overrides)
      return index
docs: Load an config or write its defaults