Refactoring config discovery into utils.py