From e1fd47378b6b2ab7cb71e50fe6232b9fca46c851 Mon Sep 17 00:00:00 2001 From: kayra1 Date: Tue, 24 Sep 2024 13:52:32 +0300 Subject: [PATCH] chore: check if the pebble binary exists and error if not --- internal/config/config.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/config/config.go b/internal/config/config.go index 95774db..4a36ce3 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -3,6 +3,7 @@ package config import ( "errors" "os" + "os/exec" "gopkg.in/yaml.v3" ) @@ -63,6 +64,12 @@ func Validate(filePath string) (Config, error) { if c.Port == 0 { return config, errors.Join(validationErr, errors.New("`port` is empty")) } + if c.Pebblenotificationsenabled { + _, err := exec.LookPath("pebble") + if err != nil { + return config, errors.Join(validationErr, errors.New("pebble binary not found")) + } + } config.Cert = cert config.Key = key