Celebal Technologies frontend dashboards receive configuration data as nested JSON-like objects. Implement flatten_config to convert every nested dictionary or list value into a single dictionary whose keys use dot-separated paths.
The input is a JSON-like Python value containing dictionaries, lists, and primitive values: strings, numbers, booleans, or None. Dictionary keys are non-empty strings that do not contain a dot. A dictionary child uses its key in the path, and a list child uses its zero-based index. Return a dictionary mapping each leaf path to its original value.
Non-empty dictionaries and lists must be recursively expanded. Empty dictionaries and empty lists are treated as leaf values and should be preserved. The root input is always a dictionary. Do not mutate the input.
def flatten_config(config):