Extract config to a class