www/gatus/patches/patch-config_config_go (view raw)
1Gatus has hardcoded paths where it expects to find a config file.
2This patch changes them to a more sensible values and also fixes a bug which prevents
3using different hardcoded values. Of course the latter fix could be upstreamed, but
4I just haven't found a way to explaining this yet. Seems rather weird. 'Oh, I changed
5a bunch of values in your code and it broke'. Still, I believe that this is a genuine bug
6since the code misuses the variables.
7 - la ninpre
8Index: config/config.go
9--- config/config.go.orig
10+++ config/config.go
11@@ -28,11 +28,11 @@ import (
12 const (
13 // DefaultConfigurationFilePath is the default path that will be used to search for the configuration file
14 // if a custom path isn't configured through the GATUS_CONFIG_PATH environment variable
15- DefaultConfigurationFilePath = "config/config.yaml"
16+ DefaultConfigurationFilePath = "${SYSCONFDIR}/gatus"
17
18 // DefaultFallbackConfigurationFilePath is the default fallback path that will be used to search for the
19 // configuration file if DefaultConfigurationFilePath didn't work
20- DefaultFallbackConfigurationFilePath = "config/config.yml"
21+ DefaultFallbackConfigurationFilePath = "${SYSCONFDIR}/gatus"
22 )
23
24 var (
25@@ -155,7 +155,7 @@ func LoadConfiguration(configPath string) (*Config, er
26 }
27 var config *Config
28 if fileInfo.IsDir() {
29- err := walkConfigDir(configPath, func(path string, d fs.DirEntry, err error) error {
30+ err := walkConfigDir(usedConfigPath, func(path string, d fs.DirEntry, err error) error {
31 if err != nil {
32 log.Printf("[config][LoadConfiguration] Error walking path=%s: %s", path, err)
33 return err