get updated config.json

This commit is contained in:
Alireza Ahmadi
2023-07-16 17:00:52 +02:00
parent bd8028fae5
commit f23aa3e51d

View File

@@ -358,21 +358,17 @@ func (s *ServerService) GetLogs(count string) ([]string, error) {
}
func (s *ServerService) GetConfigJson() (interface{}, error) {
// Open the file for reading
file, err := os.Open(xray.GetConfigPath())
config, err := s.xrayService.GetXrayConfig()
if err != nil {
return nil, err
}
defer file.Close()
// Read the file contents
fileContents, err := io.ReadAll(file)
contents, err := json.MarshalIndent(config, "", " ")
if err != nil {
return nil, err
}
var jsonData interface{}
err = json.Unmarshal(fileContents, &jsonData)
err = json.Unmarshal(contents, &jsonData)
if err != nil {
return nil, err
}