Chaged static sql instance to dynamic instance

This commit is contained in:
netbenix 2021-11-23 08:23:18 +01:00
parent 6f95fedbc1
commit a23791daa5
3 changed files with 8 additions and 14 deletions

View file

@ -1,4 +1,4 @@
package main
package Tools
import (
"archive/tar"
@ -32,8 +32,7 @@ func CreateBakFile(filename string, folderPath string, destinationPath string) s
logger.Fatal(err)
}
//TODO Remove Hardcoded SQL Instance
SQL.NewLogEntry(SQL.GetMariaDBInstance(), uuid.New(), SQL.LogInfo, filepath.Base(folderPath), SQL.SQLStage_Compress, SQL.REMOTE_NONE, "File successfully written.", time.Now())
SQL.NewLogEntry(SQL.GetSQLInstance(), uuid.New(), SQL.LogInfo, filepath.Base(folderPath), SQL.SQLStage_Compress, SQL.REMOTE_NONE, "File successfully written.", time.Now())
return fileName
@ -47,8 +46,7 @@ func compress(folderPath string, buf io.Writer){
tw := tar.NewWriter(zr)
fmt.Printf("[%s] Start compression...\n", filepath.Base(folderPath))
//TODO Remove Hardcoded SQL Instance
SQL.NewLogEntry(SQL.GetMariaDBInstance(), uuid.New(), SQL.LogInfo, filepath.Base(folderPath), SQL.SQLStage_Compress, SQL.REMOTE_NONE, "Start compression", time.Now())
SQL.NewLogEntry(SQL.GetSQLInstance(), uuid.New(), SQL.LogInfo, filepath.Base(folderPath), SQL.SQLStage_Compress, SQL.REMOTE_NONE, "Start compression", time.Now())
filepath.Walk(folderPath, func(file string, fi os.FileInfo, err error) error {
header, err := tar.FileInfoHeader(fi, file)
if err != nil {
@ -86,6 +84,5 @@ func compress(folderPath string, buf io.Writer){
fmt.Printf("[%s] Compression Done.\n", filepath.Base(folderPath))
//TODO Remove Hardcoded SQL Instance
SQL.NewLogEntry(SQL.GetMariaDBInstance(), uuid.New(), SQL.LogInfo, filepath.Base(folderPath), SQL.SQLStage_Compress, SQL.REMOTE_NONE, "Compression complete.", time.Now())
SQL.NewLogEntry(SQL.GetSQLInstance(), uuid.New(), SQL.LogInfo, filepath.Base(folderPath), SQL.SQLStage_Compress, SQL.REMOTE_NONE, "Compression complete.", time.Now())
}