~zethra/stargazer

a57881f4511cabf576693e3f71660bd9749d7f98 — Ben Aaron Goldberg 2 months ago 4dc46d5
FIX 20: Return error if config has no routes

Signed-off-by: Ben Aaron Goldberg <ben@benaaron.dev>
2 files changed, 9 insertions(+), 0 deletions(-)

M src/config.rs
A test_data/no_routes.ini
M src/config.rs => src/config.rs +4 -0
@@ 251,6 251,10 @@ pub fn load(config_path: impl AsRef<Path>) -> Result<Config> {

        // Reverse order so site is checked first
        sites.reverse();
        if sites.is_empty() {
            bail!("At least one route must be specified in config file. Please \
                  refer to stargazer.ini(5) for details");
        }

        Ok(Config {
            listen,

A test_data/no_routes.ini => test_data/no_routes.ini +5 -0
@@ 0,0 1,5 @@
listen = 0.0.0.0 [::1]

[:tls]
store = ./test_data/store