config: refactor config getter function to work with any config object