ilyakaznacheev / cleanenv

✨Clean and minimalistic environment configuration reader for Golang
MIT License
1.61k stars 111 forks source link

Creating new method `ReadConfigFS` which allows users to pass use `fs.FS` for loading files #136

Open Aquarthur opened 8 months ago

Aquarthur commented 8 months ago

Attempt at implementing #135 .

Quick note: I noticed that with parseFile, the file is opened before the filetype is validated. This PR pulls out the filetype validation and creates a new function getParseFunc which will return the appropriate parser function to run (if the filetype is supported). ReadConfig and ReadConfigFS then just keep going with the returned function.

Tests were added for both ReadConfigFS and getParseFunc.

Aquarthur commented 8 months ago

Hey @ilyakaznacheev , would you be able to give your thoughts on the PR? Totally understand if you're too busy to at the moment :)