On Tue, 11 Oct 2016 22:10:27 +0200, Sönke Ludwig wrote:
Am 11.10.2016 um 18:01 schrieb Alessandro Bianciotto:
Hi everybody,
I'm using the vibe.core.args package to process custom-defined command-line arguments that I define in the default json configuration file "vibe.conf": things work just fine here, but I'm wondering whether there's a way to define a different name/path for this file (e.g. having it as foo/bar.conf, or whatever). Shall I edit the package's source code or is there a way to configure this?Currently the path is fixed and the sources would have to be edited
manually. The problem is that the file is read before any application
code is run (vibe.core.core
'sshared static this
is the first to
trigger the lazy config file load).One possibility would be to define an environment variable that can be
set, another would be to add the possibility to add additional
configuration files in /etc/vibe.conf (or using a command line option).Alternatively, an API function that loads an additional configuration
file could be added, but it would only work for options that are read
after the function was called, which excludes any of vibe.d's default
options.
Thank you for your reply,
I'm not that knowledgeable about vibe.d to be able to judge what the best approach could be: in this you're in a much better position than me. In the end it depends a lot on whether you use the default or custom main, as well as on the individual use case.
I guess the quickest option would be to have the path/name of the config file to be specified in an environment variable as you suggest, but personally I would favour an API function processing the args at runtime, as you also suggested.
Do you think this may land in the core.args module?