Make the code to parse "primaries" configuration more generic so it can be reused for "parental-agents".