Merge branch 'develop'
This commit is contained in:
commit
636101605b
4 changed files with 20 additions and 7 deletions
|
|
@ -3,8 +3,8 @@
|
|||
Please keep in mind that this project is WIP.
|
||||
|
||||
## What can it do?
|
||||
- Backup you stuff via a dynamic configuration (done!)
|
||||
- Log the Backup progress to a database (in progress)
|
||||
- Backup you stuff via a dynamic configuration
|
||||
- Log the Backup progress to a database
|
||||
- Upload the files to a remote storage of your choice (see [Storage Types](#storage-types))
|
||||
|
||||
|
||||
|
|
@ -39,6 +39,7 @@ Please keep in mind that this project is WIP.
|
|||
|---------------------|:----------------:|------------------------------------------------|
|
||||
| localBackupPath | string | Path where local backups are stored |
|
||||
| **sqlConfig** | ---------------- | ---------------------------------------------- |
|
||||
| enableSQL | boolean | Enable/Disables the SQL entries
|
||||
| sqlType | string | See [DatabaseTypes](#database-types) |
|
||||
| sql-address | string | Address to the SQL Server |
|
||||
| sql-port | uint16 | SQL Server Port |
|
||||
|
|
|
|||
|
|
@ -13,20 +13,31 @@ type SQLService interface {
|
|||
}
|
||||
|
||||
func CreateDefaultTables(sqlService SQLService){
|
||||
config := Tools.GetConfig()
|
||||
if config.SQLConfig.EnableSQL{
|
||||
sqlService.createDefaultTables()
|
||||
}
|
||||
}
|
||||
|
||||
func NewLogEntry(sqlService SQLService, uuid uuid.UUID, logType LogType, backupName string, stage SQLStage, storageType RemoteStorageType, description string, timestamp time.Time){
|
||||
config := Tools.GetConfig()
|
||||
if config.SQLConfig.EnableSQL{
|
||||
sqlService.newLogEntry(uuid, logType, backupName, stage, storageType, description, timestamp)
|
||||
}
|
||||
}
|
||||
|
||||
func NewBackupEntry(sqlService SQLService, backupName string, lastBackup time.Time, localBackup bool, filePath string, storageType RemoteStorageType, remotePath string){
|
||||
config := Tools.GetConfig()
|
||||
if config.SQLConfig.EnableSQL{
|
||||
sqlService.newBackupEntry(backupName, lastBackup, localBackup, filePath, storageType, remotePath)
|
||||
}
|
||||
}
|
||||
|
||||
func GetSQLInstance() SQLService{
|
||||
config := Tools.GetConfig()
|
||||
|
||||
if !config.SQLConfig.EnableSQL { return nil }
|
||||
|
||||
switch config.SQLConfig.SqlType {
|
||||
case "mariadb": {return GetMariaDBInstance(config)}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import (
|
|||
type Config struct {
|
||||
LocalBackupPath string `json:"localBackupPath"`
|
||||
SQLConfig struct{
|
||||
EnableSQL bool `json:"enableSQL"`
|
||||
SqlType string `json:"sqlType"`
|
||||
SqlAddress string `json:"sql-address"`
|
||||
SqlPort uint16 `json:"sql-port"`
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"localBackupPath": "",
|
||||
"sqlConfig": {
|
||||
"sqlType": "",
|
||||
"enableSQL": false,
|
||||
"sql-address": "",
|
||||
"sql-port": 0,
|
||||
"database": "",
|
||||
|
|
|
|||
Reference in a new issue