Complete refactor: use templates for exporting configs