saito-rust icon indicating copy to clipboard operation
saito-rust copied to clipboard

More Configuration Options If Config File Not Found In Default Location

Open stevenzeiler opened this issue 3 years ago • 3 comments

Currently running saito requires that there be a configuration file present under the current directory/configuration however this may not match realistic expectations when running saito in production. When executing the saito binary from a different directory it panics with thread 'main' panicked at 'Failed to read configuration.: configuration file "/Users/zyler/github/saito-live/configuration/base" not found', /Users/zyler/github/saito-live/saito-rust/src/consensus.rs:136:44

Options for handling this gracefully would be:

  1. Sane defaults without a configuration file

  2. Allow path to configuration file to be specified via command line ie saito --config=/path/to/config.yml or via environment variable ie $SAITO_CONFIG_PATH

  3. If file not found search for configuration in a user-standard directory such as $HOME/.saito

  4. If user config directory is not found search in os-specific config path for instance /etc/saito on linux

This error I encountered when using homebrew to install saito on my mac, and realized the node operator onboarding experience could be improved with better configuration options.

(https://github.com/saito-live/homebrew-saito to try installation via homebrew on mac.)

stevenzeiler avatar Feb 13 '22 13:02 stevenzeiler

hi @stevenzeiler thank for pointing this out. This issue was fixed in a branch and still didn't get merged, however we're planning a big restructure for our codebase. In the meantime, if you want to correct it yourself, you may want to check this branch. But as I said, this branch's still under development.

thaodt avatar Feb 14 '22 01:02 thaodt

Great thanks thaodt I will check out that branch.

stevenzeiler avatar Feb 14 '22 06:02 stevenzeiler

Running into the same issue. Attempting to run saito_rust on the suggested branch with the boilerplate configuration files yielded as per @thaodt 's recommendation yielded:

mw@system:~/saito-rust$ git checkout remotes/origin/network_refactor_david2
mw@system:~/saito-rust$ git branch
* (HEAD detached at origin/network_refactor_david2)
  main

mw@system:~/saito-rust/target/release$ ./saito_rust 
LOG LEVEL SET TO: info. To set log level use RUST_LOG=[trace, info, debug, warn, error]
thread 'main' panicked at 'Failed to read configuration.: invalid type: unit value, expected struct NetworkSettings', /home/user1/saito-rust/src/consensus.rs:136:44
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

This is on a 64bit Debian Server.

mat888 avatar May 06 '22 13:05 mat888