config: remove duplicated code