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
It would be more readable if all these options are located in a file. Each line would set only one value in this format: name(=value)?.
Using previous example, these options would be specified in a file config.cfg:
I suggest to add, in the main function of all daemons, the following logic:
if argc > 1 && argv[1] matches *.cfg
override argc and argv with content from config file
And the parsing of the configuration file would be done in daemon/src/common/config.c. It would produce an array of strings, along with the number of strings in the array.
This would be written roughly in this way:
/** * @param[in] filePath * @param[out] args * @return negative number if an error occured, argc otherwise */intParseConfigurationFile(char*filePath, char**args)
{
ret=1openfileinfilePathn=numberofnon-emptylinesforeachlineinfile:
iflineisempty:
skipname,value=match(line, "name(=value)?")
args.append("--"+name)
ret++ifvalue:
args.append(value)
ret++returnret
}
The text was updated successfully, but these errors were encountered:
Hello,
Here is a proposal for configuring daemon using a file instead of specifying options on the command line.
Description
Launching the client daemon can require many options. For instance, this project, https://github.com/CreatorDev/ci40-weather-station, asks people to run
this command to launch the client daemon:
It would be more readable if all these options are located in a file. Each line would set only one value in this format:
name(=value)?
.Using previous example, these options would be specified in a file config.cfg:
and the client would be launched in this way:
Implementation
I suggest to add, in the main function of all daemons, the following logic:
And the parsing of the configuration file would be done in daemon/src/common/config.c. It would produce an array of strings, along with the number of strings in the array.
This would be written roughly in this way:
The text was updated successfully, but these errors were encountered: