You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does configen support optional values? for example can we declare String? in the mapping file. The reasoning for this is that some environments don't need all the properties.
The text was updated successfully, but these errors were encountered:
Well, no, it's not supposed to. It specifically defeats the purpose of the tool, which is robustness.
But I think there is a way to beat the system if you really want to. Configen supports any type, which is how it allows enums such as, for example, LogLevel for which the value may be defined in the property list as .warning, .error, etc. This means you could define your type as String? and enter the value in the mapping file as nil or "some value" (note you need to provide the quotes in this case, because the value gets printed as is to the .swift source file.
I haven't tried this, and I wouldn't recommend it. You're better off defining the type as String and providing a value even where you don't need it. For example, in the case of a string, provide an empty string and in code only use it if non-empty. At least then it sticks out as missing in the environments that do rely on it.
Does configen support optional values? for example can we declare
String?
in the mapping file. The reasoning for this is that some environments don't need all the properties.The text was updated successfully, but these errors were encountered: