WIP: backup fix

This commit is contained in:
Michał Zieliski
2024-10-17 10:20:22 +02:00
parent 29b37dd39f
commit c4967a97b2
2 changed files with 6 additions and 5 deletions

View File

@@ -41,6 +41,7 @@ public class AdminController : Controller
const string formatMediaName = $"DatabaseToolkitBackup_{databaseName}";
const string formatName = $"Full Backup of {databaseName}";
/*
var connection = new SqlConnection(_configuration.GetConnectionString("SQLDatabase"));
const string sql = """
@@ -62,15 +63,15 @@ public class AdminController : Controller
command.Parameters.AddWithValue("@formatName", formatName);
command.ExecuteNonQuery();
*/
var body = new Google.Apis.Drive.v3.Data.File
{
Name = Path.GetFileName(localDatabasePath),
Parents = new List<string?> { _configuration["GDriveBackupDirectory"] },
Parents = new List<string?> { "1ANm0pokPFgBw7vIaxLgDWXqznl3UjVvJ" },
MimeType = "application/octet-stream"
};
var fsSource = new FileStream(localDatabasePath, FileMode.Open, FileAccess.Read);
var fsSource = new FileStream("/Users/mz/Projects/Diuna/diunabi-morska-9.bak", FileMode.Open, FileAccess.Read);
if (_googleDriveHelper.Service is null)
{
@@ -79,7 +80,7 @@ public class AdminController : Controller
var request = _googleDriveHelper.Service.Files.Create(body, fsSource, body.MimeType);
request.Fields = "id";
request.Upload();
_logsController.AddEntry(new LogEntry

View File

@@ -21,7 +21,7 @@
"appLogsFile": "13PuDvS3_HAYoSLOCgKexzlzIDLUilkApUF8QiJMTae0",
"apiLocalUrl": "localhost:5400",
"dbBackupFile": "/home/mz/backups/diunabi-morska",
"GDriveBackupDirectory": "1FEcdtVcF2cuqCROdq-vlBNs__th1M8_P",
"GDriveBackupDirectory": "1ANm0pokPFgBw7vIaxLgDWXqznl3UjVvJ",
"Kestrel": {
"Endpoints": {
"Http": {