HomePhabricator
Diffusion Comm 22c5aac90661

[services] Tunnelbroker - Add the ability to change the default config files…

Description

[services] Tunnelbroker - Add the ability to change the default config files directory to run in Nix

Summary:
By default, the Tunnelbroker looks for the config files in a ~/tunnelbroker/ directory. To add the ability to run the Tunnelbroker in Nix or any other environment we should add the ability to change the default directory for config files location. The ability to change the default config files directory is added by using the TUNNELBROKER_CONFIG_FILE_DIRECTORY exported environment variable.

This task introduces a few small related changes:

  • Constants for the config files location were split into directory and file names for the production and sandbox configs.
  • Tunnelbroker's tunnelbroker-dev.ini config renamed to tunnelbroker-sandbox.ini.
  • Add the ability to overwrite the config files directory by using of exported TUNNELBROKER_CONFIG_FILE_DIRECTORY environment variable in a ConfigManager::load() method.

Related Linear task: ENG-1589

Test Plan:
Docker:

Running of the yarn run-tunnelbroker-service-in-sandbox successfully built the app and the ~/tunnelbroker/ directory is used as the config files location.

Nix:

Enter the nix environment by using nix develop command.
Run cmake -B build . && make -C build -j4 in the services/tunnelbroker directory to build the service.
Export the TUNNELBROKER_CONFIG_FILE_DIRECTORY environment variable with the directory of the service location (services/tunnelbroker).
Running of build/bin/tunnelbroker binary will not produce any config-related errors.

Exporting the wrong location using the TUNNELBROKER_CONFIG_FILE_DIRECTORY and running of build/bin/tunnelbroker will produce the config loading error on startup.

Reviewers: karol, tomek, varun, jon

Reviewed By: tomek, jon

Subscribers: jon, ashoat, tomek, adrian, atul, karol, abosh

Differential Revision: https://phab.comm.dev/D4841