[fold] refactor repetitive code into get_server_config()