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