extract getConfigDir method out