Factorize config load function