Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
EvilBeaver committed Aug 23, 2021
2 parents 6330667 + 946bf92 commit 79ccf83
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pipeline {
agent none

environment {
ReleaseNumber = '0.9.0'
ReleaseNumber = '0.9.1'
}
stages {

Expand Down
11 changes: 8 additions & 3 deletions src/OneScript/Database/DatabaseExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using OneScript.WebHost.Application;
using OneScript.WebHost.Infrastructure;
using ScriptEngine;

Expand All @@ -22,9 +24,6 @@ public static class DatabaseExtensions

public static void AddDatabaseByConfiguration(this IServiceCollection services, IConfiguration config)
{
if (!config.GetChildren().Any(item => item.Key == ConfigSectionName))
return;

var dbSettings = config.GetSection(ConfigSectionName);

// Делаем доступным для прочих частей приложения
Expand Down Expand Up @@ -70,9 +69,11 @@ private static DbContextOptions<ApplicationDbContext> ConfigureDbOptions(IServic

public static void PrepareDbEnvironment(IServiceProvider services, RuntimeEnvironment environment)
{
var logger = services.GetService<ILogger<ApplicationInstance>>();
var dbOptions = services.GetService<IOptions<OscriptDbOptions>>().Value;
if (dbOptions != null && dbOptions.DbType != SupportedDatabase.Unknown)
{
logger.LogDebug($"Database enabled: {dbOptions.DbType}");
var dbctx = services.GetService<ApplicationDbContext>();
dbctx.Database.EnsureCreated();

Expand All @@ -86,6 +87,10 @@ public static void PrepareDbEnvironment(IServiceProvider services, RuntimeEnviro
environment.InjectGlobalProperty(ib, "ИнформационнаяБаза", true);
environment.InjectGlobalProperty(ib, "InfoBase", true);
}
else
{
logger.LogDebug("No database configured");
}
}
}

Expand Down
6 changes: 5 additions & 1 deletion src/OneScript/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ public static void Main(string[] args)
var options = ConfigureHostingMode(builder, configInstance);

builder.UseConfiguration(configInstance)
.UseKestrel(opts => opts.AllowSynchronousIO = true)
.UseKestrel(opts =>
{
configInstance.Bind("Kestrel", opts);
opts.AllowSynchronousIO = true;
})
.UseIISIntegration()
.UseStartup<Startup>()
.UseApplicationInsights()
Expand Down

0 comments on commit 79ccf83

Please sign in to comment.