VisionSystemsInc / terra

Terra - Run your algorithm anywhere on earth
MIT License
0 stars 3 forks source link

Add ability to use an empty config file #179

Closed andyneff closed 10 months ago

andyneff commented 10 months ago

Adds the feature that an empty settings file is parsed like a normal empty dictionary. There are a number of reasons why this feature is useful, e.g. I don't want to create an empty json file and just want to pass in /dev/null/Nul.

Instead of hard coding /dev/null and Nul, it just allows any empty file to be parsed as {}.


I looked into changing the default value of the settings file parser to use to dev null, however the current behavior of add_settings_file to the argument parser already handles this by setting the settings file to required unless TERRA_SETTINGS_FILE is set, in which case it become optional. So I decided not to unexpectedly change this behavior for all Terra projects. If this is a desired feature, we can add a parameter to add_settings_file to support both scenarios.

So in cases where we want the settings file to be optional, we can set TERRA_SETTINGS_FILE to dev null in the project.env file, local.env, or other environment configuration to make it behave that way.

andyneff commented 10 months ago

As per an offline discussion, I went ahead and added a flag to add_settings_file to allow /dev/null/Nul to be the default setting filename, which can be enabled on a per app basis.