Rebuild config file from template, using defines