aluttik / go-crossplane

An unofficial Go port of the NGINX config/JSON converter crossplane
Apache License 2.0
50 stars 15 forks source link

feat: added ability to specify an alternative file open function to aid in testing #8

Closed bonnyr closed 4 years ago

bonnyr commented 4 years ago

added an option to allow users to pass a function to be used to perform file open on config files.

This can be used in testing scenarios where something like afero.MemFS can be used to represent the file system and files do not have to be created on the actual file system. This is important when using directives like include and references to certificate files which have to point to fixed locations on on the file system.

It may be useful to extend this to allow passing the entire afero File System abstraction, but this is a first step.

aluttik commented 4 years ago

Looks good to me! This project was basically written as a line-by-line copy of crossplane as closely as possible so it's not idiomatic Go. Any step towards that is a step in the right direction :)

Thanks for the contribution!