From 2fb37a99532bb7fdcf220dfc298a57d333d47af3 Mon Sep 17 00:00:00 2001 From: netbenix Date: Fri, 31 Dec 2021 15:34:32 +0100 Subject: [PATCH] refactor(Config): Removed unused property --- Tools/Config.go | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/Tools/Config.go b/Tools/Config.go index 87feb19..4e0721c 100644 --- a/Tools/Config.go +++ b/Tools/Config.go @@ -7,21 +7,20 @@ import ( ) type Config struct { - LocalBackupPath string `json:"localBackupPath"` - SQLConfig struct{ - EnableSQL bool `json:"enableSQL"` - SqlType string `json:"sqlType"` + SQLConfig struct { + EnableSQL bool `json:"enableSQL"` + SqlType string `json:"sqlType"` SqlAddress string `json:"sql-address"` - SqlPort uint16 `json:"sql-port"` - Database string `json:"database"` - DbUser string `json:"db-user"` + SqlPort uint16 `json:"sql-port"` + Database string `json:"database"` + DbUser string `json:"db-user"` DbPassword string `json:"db-password"` } `json:"sqlConfig"` - FolderToBackup []struct{ - BackupName string `json:"backupName"` - FolderPath string `json:"folderPath"` + FolderToBackup []struct { + BackupName string `json:"backupName"` + FolderPath string `json:"folderPath"` RemoteStorageType string `json:"remoteStorageType"` - RemoteTargetPath string `json:"remoteTargetPath"` + RemoteTargetPath string `json:"remoteTargetPath"` CreateLocalBackup bool `json:"createLocalBackup"` LocalTargetPath string `json:"LocalTargetPath"` } `json:"foldersToBackup"` @@ -37,12 +36,12 @@ func readConfig() []byte { return file } -func CheckIfConfigExists(){ +func CheckIfConfigExists() { logger := Logging.DetailedLogger("ConfigHandler", "CheckIfConfigExists") - if _, err := os.Stat("config/config.json"); os.IsNotExist(err){ + if _, err := os.Stat("config/config.json"); os.IsNotExist(err) { _, fileErr := os.OpenFile("config/config.json", os.O_CREATE, 0775) - if fileErr != nil{ + if fileErr != nil { logger.Fatal(fileErr) } generateDefaultConfig() @@ -79,4 +78,4 @@ func GetConfig() Config { } return config -} \ No newline at end of file +}