refactor of v2 config for agent, server still a wip