userver-framework / userver

Production-ready C++ Asynchronous Framework with rich functionality
https://userver.tech
Apache License 2.0
2.37k stars 275 forks source link

Ability to acquire config file path in already started service #643

Open DmitriyH opened 2 months ago

DmitriyH commented 2 months ago

Currently, there is no option to find out in already started service, which config file path was used to read server config. But It would be useful. For example, if there were this option, it would be possible to specify additional file paths in config, relative to config file location, regardless of process current directory.

Currently, the sample below doesn't work, but with that option would:

project_dir$ cat static_config.yaml
...
  my-service:
    data-file-path: subdir/data.json
...

project_dir$ my_service --config static_config.yaml
another_dir$ my_service --config /home/.../project_dir/static_config.yaml

A very simple solution would be: