-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/redesign-tiles
- Loading branch information
Showing
11 changed files
with
571 additions
and
647 deletions.
There are no files selected for viewing
429 changes: 206 additions & 223 deletions
429
common/services/ASC.Data.Backup/Api/BackupController.cs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,8 @@ | ||
| ||
using System.Collections.Generic; | ||
namespace ASC.Data.Backup.ApiModels; | ||
|
||
using ASC.Api.Collections; | ||
|
||
namespace ASC.Data.Backup.ApiModels | ||
public class BackupDto | ||
{ | ||
public class BackupDto | ||
{ | ||
public string StorageType { get; set; } | ||
public bool BackupMail { get; set; } | ||
public IEnumerable<ItemKeyValuePair<object, object>> StorageParams { get; set; } | ||
} | ||
public string StorageType { get; set; } | ||
public bool BackupMail { get; set; } | ||
public IEnumerable<ItemKeyValuePair<object, object>> StorageParams { get; set; } | ||
} |
17 changes: 6 additions & 11 deletions
17
common/services/ASC.Data.Backup/ApiModels/BackupRestoreDto.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,9 @@ | ||
using System.Collections.Generic; | ||
namespace ASC.Data.Backup.ApiModels; | ||
|
||
using ASC.Api.Collections; | ||
|
||
namespace ASC.Data.Backup.ApiModels | ||
public class BackupRestoreDto | ||
{ | ||
public class BackupRestoreDto | ||
{ | ||
public string BackupId { get; set; } | ||
public object StorageType { get; set; } | ||
public IEnumerable<ItemKeyValuePair<object, object>> StorageParams { get; set; } | ||
public bool Notify { get; set; } | ||
} | ||
public string BackupId { get; set; } | ||
public object StorageType { get; set; } | ||
public IEnumerable<ItemKeyValuePair<object, object>> StorageParams { get; set; } | ||
public bool Notify { get; set; } | ||
} |
31 changes: 13 additions & 18 deletions
31
common/services/ASC.Data.Backup/ApiModels/BackupScheduleDto.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,17 @@ | ||
using System.Collections.Generic; | ||
namespace ASC.Data.Backup.ApiModels; | ||
|
||
using ASC.Api.Collections; | ||
|
||
namespace ASC.Data.Backup.ApiModels | ||
public class BackupScheduleDto | ||
{ | ||
public class BackupScheduleDto | ||
{ | ||
public string StorageType { get; set; } | ||
public IEnumerable<ItemKeyValuePair<object, object>> StorageParams { get; set; } | ||
public string BackupsStored { get; set; } | ||
public Cron CronParams { get; set; } | ||
public bool BackupMail { get; set; } | ||
} | ||
public string StorageType { get; set; } | ||
public IEnumerable<ItemKeyValuePair<object, object>> StorageParams { get; set; } | ||
public string BackupsStored { get; set; } | ||
public Cron CronParams { get; set; } | ||
public bool BackupMail { get; set; } | ||
} | ||
|
||
public class Cron | ||
{ | ||
public string Period { get; set; } | ||
public string Hour { get; set; } | ||
public string Day { get; set; } | ||
} | ||
public class Cron | ||
{ | ||
public string Period { get; set; } | ||
public string Hour { get; set; } | ||
public string Day { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
global using System; | ||
global using System.Collections.Generic; | ||
global using System.IO; | ||
global using System.Linq; | ||
global using System.Runtime.InteropServices; | ||
global using System.Threading; | ||
global using System.Threading.Tasks; | ||
|
||
global using ASC.Api.Collections; | ||
global using ASC.Api.Core; | ||
global using ASC.Common; | ||
global using ASC.Common.Caching; | ||
global using ASC.Common.Logging; | ||
global using ASC.Common.Threading; | ||
global using ASC.Common.Utils; | ||
global using ASC.Core; | ||
global using ASC.Core.Billing; | ||
global using ASC.Data.Backup; | ||
global using ASC.Data.Backup.ApiModels; | ||
global using ASC.Data.Backup.Contracts; | ||
global using ASC.Data.Backup.Controllers; | ||
global using ASC.Data.Backup.Services; | ||
global using ASC.Data.Backup.Storage; | ||
global using ASC.Files.Core; | ||
global using ASC.Web.Api.Routing; | ||
global using ASC.Web.Studio.Core.Notify; | ||
global using ASC.Web.Studio.Utility; | ||
|
||
global using Autofac; | ||
global using Autofac.Extensions.DependencyInjection; | ||
|
||
global using Microsoft.AspNetCore.Builder; | ||
global using Microsoft.AspNetCore.Hosting; | ||
global using Microsoft.AspNetCore.Mvc; | ||
global using Microsoft.Extensions.Configuration; | ||
global using Microsoft.Extensions.DependencyInjection; | ||
global using Microsoft.Extensions.Hosting; | ||
global using Microsoft.Extensions.Options; | ||
|
||
global using StackExchange.Redis.Extensions.Core.Configuration; | ||
global using StackExchange.Redis.Extensions.Newtonsoft; | ||
|
||
global using static ASC.Data.Backup.BackupAjaxHandler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1,75 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Runtime.InteropServices; | ||
using System.Threading.Tasks; | ||
|
||
using ASC.Api.Core; | ||
using ASC.Common.Utils; | ||
|
||
using Autofac.Extensions.DependencyInjection; | ||
|
||
using Microsoft.AspNetCore.Hosting; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.Hosting; | ||
|
||
namespace ASC.Data.Backup | ||
{ | ||
public class Program | ||
{ | ||
public async static Task Main(string[] args) | ||
{ | ||
var host = CreateHostBuilder(args).Build(); | ||
|
||
await host.RunAsync(); | ||
} | ||
|
||
public static IHostBuilder CreateHostBuilder(string[] args) => | ||
Host.CreateDefaultBuilder(args) | ||
.UseSystemd() | ||
.UseWindowsService() | ||
.UseServiceProviderFactory(new AutofacServiceProviderFactory()) | ||
.ConfigureWebHostDefaults(webBuilder => | ||
{ | ||
var builder = webBuilder.UseStartup<Startup>(); | ||
|
||
builder.ConfigureKestrel((hostingContext, serverOptions) => | ||
{ | ||
var kestrelConfig = hostingContext.Configuration.GetSection("Kestrel"); | ||
|
||
if (!kestrelConfig.Exists()) return; | ||
|
||
var unixSocket = kestrelConfig.GetValue<string>("ListenUnixSocket"); | ||
|
||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) | ||
{ | ||
if (!String.IsNullOrWhiteSpace(unixSocket)) | ||
{ | ||
unixSocket = String.Format(unixSocket, hostingContext.HostingEnvironment.ApplicationName.Replace("ASC.", "").Replace(".", "")); | ||
|
||
serverOptions.ListenUnixSocket(unixSocket); | ||
} | ||
} | ||
}); | ||
}) | ||
.ConfigureAppConfiguration((hostContext, config) => | ||
{ | ||
var buided = config.Build(); | ||
var path = buided["pathToConf"]; | ||
if (!Path.IsPathRooted(path)) | ||
{ | ||
path = Path.GetFullPath(CrossPlatform.PathCombine(hostContext.HostingEnvironment.ContentRootPath, path)); | ||
} | ||
config.SetBasePath(path); | ||
var env = hostContext.Configuration.GetValue("ENVIRONMENT", "Production"); | ||
config | ||
.AddJsonFile("appsettings.json") | ||
.AddJsonFile($"appsettings.{env}.json", true) | ||
.AddJsonFile("storage.json") | ||
.AddJsonFile("notify.json") | ||
.AddJsonFile($"notify.{env}.json", true) | ||
.AddJsonFile("backup.json") | ||
.AddJsonFile("kafka.json") | ||
.AddJsonFile($"kafka.{env}.json", true) | ||
.AddJsonFile("redis.json") | ||
.AddJsonFile($"redis.{env}.json", true) | ||
.AddEnvironmentVariables() | ||
.AddCommandLine(args) | ||
.AddInMemoryCollection(new Dictionary<string, string> | ||
{ | ||
{"pathToConf", path } | ||
} | ||
); | ||
}) | ||
.ConfigureNLogLogging(); | ||
|
||
} | ||
} | ||
var builder = WebApplication.CreateBuilder(args); | ||
|
||
builder.Host.UseSystemd(); | ||
builder.Host.UseWindowsService(); | ||
builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory()); | ||
|
||
builder.WebHost.ConfigureKestrel((hostingContext, serverOptions) => | ||
{ | ||
var kestrelConfig = hostingContext.Configuration.GetSection("Kestrel"); | ||
|
||
if (!kestrelConfig.Exists()) return; | ||
|
||
var unixSocket = kestrelConfig.GetValue<string>("ListenUnixSocket"); | ||
|
||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) | ||
{ | ||
if (!string.IsNullOrWhiteSpace(unixSocket)) | ||
{ | ||
unixSocket = string.Format(unixSocket, hostingContext.HostingEnvironment.ApplicationName.Replace("ASC.", "").Replace(".", "")); | ||
|
||
serverOptions.ListenUnixSocket(unixSocket); | ||
} | ||
} | ||
}); | ||
|
||
builder.Host.ConfigureAppConfiguration((hostContext, config) => | ||
{ | ||
var buided = config.Build(); | ||
|
||
var path = buided["pathToConf"]; | ||
|
||
if (!Path.IsPathRooted(path)) | ||
{ | ||
path = Path.GetFullPath(CrossPlatform.PathCombine(hostContext.HostingEnvironment.ContentRootPath, path)); | ||
} | ||
|
||
config.SetBasePath(path); | ||
|
||
var env = hostContext.Configuration.GetValue("ENVIRONMENT", "Production"); | ||
config | ||
.AddJsonFile("appsettings.json") | ||
.AddJsonFile($"appsettings.{env}.json", true) | ||
.AddJsonFile("storage.json") | ||
.AddJsonFile("notify.json") | ||
.AddJsonFile($"notify.{env}.json", true) | ||
.AddJsonFile("backup.json") | ||
.AddJsonFile("kafka.json") | ||
.AddJsonFile($"kafka.{env}.json", true) | ||
.AddJsonFile("redis.json") | ||
.AddJsonFile($"redis.{env}.json", true) | ||
.AddEnvironmentVariables() | ||
.AddCommandLine(args) | ||
.AddInMemoryCollection(new Dictionary<string, string> | ||
{ | ||
{"pathToConf", path } | ||
} | ||
); | ||
}); | ||
|
||
builder.Host.ConfigureNLogLogging(); | ||
|
||
var startup = new Startup(builder.Configuration, builder.Environment); | ||
|
||
startup.ConfigureServices(builder.Services); | ||
|
||
builder.Host.ConfigureContainer<ContainerBuilder>(containerBuilder => | ||
{ | ||
startup.ConfigureContainer(containerBuilder); | ||
}); | ||
|
||
var app = builder.Build(); | ||
|
||
startup.Configure(app, app.Environment); | ||
|
||
app.Run(); |
Oops, something went wrong.