nginxinc / crossplane

Quick and reliable way to convert NGINX configurations into JSON and back.
Apache License 2.0
717 stars 86 forks source link

Option to ignore includes #19

Closed veenarathna closed 6 years ago

veenarathna commented 6 years ago

This is a nice to have option at least in my usecase. Right now I am 'text' validating the config generated by controller. Instead I plan to run in through crossplane and validate the args and the directives part. Controller has some default 'include' directives but does not generate them. So when I run it through crossplane it complains about those missing includes.

aluttik commented 6 years ago

@veenarathna: Sorry for the late reply, I just got back from vacation.

This sounds like a good feature! :)

Here's a spec of what I have in mind:
I'll add a --single-file flag or something to parse to disable the include functionality, as well as an --exclude argument that can be used to exclude a list of directives entirely from the payload (which is useful for preserving privacy in some use cases). Of course these would be accessible from the python module as well.

Does that sound like it would cover your use case?

veenarathna commented 6 years ago

Sounds good. Would it be a ‘list' of excludes?

thanks -Veena

On Jan 5, 2018, at 12:32 PM, Arie van Luttikhuizen notifications@github.com wrote:

@veenarathna https://github.com/veenarathna: Sorry for the late reply, I just got back from vacation.

This sounds like a good feature! :)

Here's a spec of what I have in mind: I'll add a --single-file flag or something to parse to disable the include functionality, as well as an --exclude argument that can be used to exclude certain directives entirely from the payload (which is useful for preserving privacy in some use cases). Of course these would be accessible from the python module as well.

Does that sound like it would cover your use case?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nginxinc/crossplane/issues/19#issuecomment-355658039, or mute the thread https://github.com/notifications/unsubscribe-auth/AfsuL5lS8bBnhGidJX5wmmzhupr5rHWLks5tHobOgaJpZM4RLQJ7.

aluttik commented 6 years ago

Yeah, for the --ignore option anyway. Check out the PR above :)

You'll probably want to use --single-file for your use case though, and that's just a flag.

Anyway, from the python module you can use the new features like this:

crossplane.parse(filename, single=True)
crossplane.parse(filename, ignore=['foo', 'bar', 'baz'])

And from the CLI you can use them like this:

crossplane parse <filename> --single-file
crossplane parse <filename> --ignore=foo,bar,baz
aluttik commented 6 years ago

@veenarathna: I released a new version of crossplane (0.1.3). Running pip install -U crossplane or whatever should update it so you can use the new options.