File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
internal/commands/diagnose Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 5
5
"fmt"
6
6
"os"
7
7
8
- "github.com/observeinc/observe-agent/internal/root "
8
+ "github.com/spf13/viper "
9
9
"gopkg.in/yaml.v2"
10
10
)
11
11
@@ -21,22 +21,23 @@ func validateYaml(yamlContent []byte) error {
21
21
}
22
22
23
23
func checkConfig () (any , error ) {
24
- if root .CfgFile == "" {
24
+ configFile := viper .ConfigFileUsed ()
25
+ if configFile == "" {
25
26
return nil , fmt .Errorf ("no config file defined" )
26
27
}
27
- configFile , err := os .ReadFile (root . CfgFile )
28
+ contents , err := os .ReadFile (configFile )
28
29
if err != nil {
29
30
return nil , err
30
31
}
31
- if err = validateYaml (configFile ); err != nil {
32
+ if err = validateYaml (contents ); err != nil {
32
33
return ConfigTestResult {
33
- root . CfgFile ,
34
+ configFile ,
34
35
false ,
35
36
err .Error (),
36
37
}, nil
37
38
}
38
39
return ConfigTestResult {
39
- ConfigFile : root . CfgFile ,
40
+ ConfigFile : configFile ,
40
41
Passed : true ,
41
42
}, nil
42
43
}
You can’t perform that action at this time.
0 commit comments