moving logic to locate network config and endpoint to a function