containerpilot icon indicating copy to clipboard operation
containerpilot copied to clipboard

should -template validate configuration?

Open tgross opened this issue 8 years ago • 0 comments

The notion of ContainerPilot having a -validate command came up in a sidebar discussion between @geek and @cheapRoc and myself. Currently you can use the -template subcommand to render the template, but it only does the template rendering and doesn't even make sure the configuration is syntactically valid.

A hypothetical -validate command would have to render the template anyways, because otherwise there's no guarantee that the configuration file is syntactically valid. So it seems like the cleanest way to handle this would be to have the -template subcommand also validate that the ContainerPilot configuration is valid.

In terms of the implementation, this would make it so that RenderConfig calls LoadConfig and then renders the output. This would eliminate a bunch of duplicated code in RenderConfig too.

My major concern with this is that currently an invalid configuration will render just fine with -template, and this changes the behavior in an error condition. On the other hand, right now someone can render a bad template and the only find out when they try to reload that config, which will get them an error anyways.

tgross avatar Aug 08 '17 19:08 tgross