Fitment update
This commit is contained in:
@@ -6,7 +6,6 @@ using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PartSource.Automation.Jobs;
|
||||
using PartSource.Automation.Jobs.POC;
|
||||
using PartSource.Automation.Models.Configuration;
|
||||
using PartSource.Automation.Services;
|
||||
using PartSource.Data;
|
||||
using PartSource.Data.AutoMapper;
|
||||
@@ -15,58 +14,56 @@ using PartSource.Services;
|
||||
using Ratermania.Automation.DependencyInjection;
|
||||
using Ratermania.Automation.Logging;
|
||||
using Ratermania.Shopify.DependencyInjection;
|
||||
using Ratermania.JwtSpot.Configuration;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PartSource.Automation
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static async Task Main(string[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
using IHost host = CreateHostBuilder().Build();
|
||||
class Program
|
||||
{
|
||||
static async Task Main(string[] args){
|
||||
try
|
||||
{
|
||||
using IHost host = CreateHostBuilder().Build();
|
||||
|
||||
await host.StartAsync();
|
||||
}
|
||||
await host.StartAsync();
|
||||
}
|
||||
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.ToString());
|
||||
throw;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.ToString());
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private static IHostBuilder CreateHostBuilder()
|
||||
{
|
||||
return Host.CreateDefaultBuilder()
|
||||
.ConfigureAppConfiguration(builder =>
|
||||
{
|
||||
string environment = Environment.GetEnvironmentVariable("AUTOMATION_ENVIRONMENT");
|
||||
private static IHostBuilder CreateHostBuilder()
|
||||
{
|
||||
return Host.CreateDefaultBuilder()
|
||||
.ConfigureAppConfiguration(builder =>
|
||||
{
|
||||
string environment = Environment.GetEnvironmentVariable("AUTOMATION_ENVIRONMENT");
|
||||
|
||||
builder.SetBasePath(Directory.GetCurrentDirectory())
|
||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||
.AddJsonFile($"appsettings.{environment}.json", optional: true, reloadOnChange: true);
|
||||
})
|
||||
.ConfigureServices((builder, services) =>
|
||||
{
|
||||
services.AddDbContext<PartSourceContext>(options =>
|
||||
options.UseSqlServer(builder.Configuration.GetConnectionString("PartSourceDatabase"), opts => opts.EnableRetryOnFailure())
|
||||
)
|
||||
builder.SetBasePath(Directory.GetCurrentDirectory())
|
||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||
.AddJsonFile($"appsettings.{environment}.json", optional: true, reloadOnChange: true);
|
||||
})
|
||||
.ConfigureServices((builder, services) =>
|
||||
{
|
||||
services.AddDbContext<PartSourceContext>(options =>
|
||||
options.UseSqlServer(builder.Configuration.GetConnectionString("PartSourceDatabase"), opts => opts.EnableRetryOnFailure())
|
||||
)
|
||||
|
||||
.AddDbContext<FitmentContext>(options =>
|
||||
options.UseSqlServer(builder.Configuration.GetConnectionString("FitmentDatabase"), opts =>
|
||||
{
|
||||
opts.EnableRetryOnFailure();
|
||||
opts.CommandTimeout(600);
|
||||
})
|
||||
)
|
||||
.AddDbContext<FitmentContext>(options =>
|
||||
options.UseSqlServer(builder.Configuration.GetConnectionString("FitmentDatabase"), opts =>
|
||||
{
|
||||
opts.EnableRetryOnFailure();
|
||||
opts.CommandTimeout(600);
|
||||
})
|
||||
)
|
||||
|
||||
.AddShopify(options =>
|
||||
{
|
||||
.AddShopify(options =>
|
||||
{
|
||||
options.ApiKey = builder.Configuration["Shopify:ApiKey"];
|
||||
options.ApiSecret = builder.Configuration["Shopify:ApiSecret"];
|
||||
options.ApiVersion = "2022-10";
|
||||
@@ -78,42 +75,55 @@ namespace PartSource.Automation
|
||||
//options.ShopDomain = "dev-partsource.myshopify.com";
|
||||
})
|
||||
|
||||
.AddAutomation(options =>
|
||||
options.HasBaseInterval(new TimeSpan(0, 15, 0))
|
||||
.HasMaxFailures(3)
|
||||
.HasJob<ExecuteSsisPackages>(options =>
|
||||
options.HasInterval(new TimeSpan(24, 0, 0))
|
||||
.StartsAt(DateTime.Today.AddHours(26)))
|
||||
.HasJob<UpdatePricing>(options =>
|
||||
options.HasInterval(new TimeSpan(24, 0, 0))
|
||||
.StartsAt(DateTime.Today.AddHours(27))
|
||||
.HasDependency<ExecuteSsisPackages>())
|
||||
.UseApiServer(opts =>
|
||||
opts.HasApiKey("PartsourceAPIKey")
|
||||
.UseJwtSpot(jwt =>
|
||||
jwt.HasAudience(builder.Configuration["JwtSpot:Audience"])
|
||||
.HasIssuer(builder.Configuration["JwtSpot:Issuer"])
|
||||
.UseX509Certificate(builder.Configuration["JwtSpot:CertPath"])
|
||||
.UseJwksUrl(builder.Configuration["JwtSpot:JwksUrl"])))
|
||||
.UseSqlServer(builder.Configuration.GetConnectionString("AutomationDatabase")))
|
||||
.AddAutomation(options =>
|
||||
{
|
||||
options.HasBaseInterval(new TimeSpan(0, 15, 0))
|
||||
.HasMaxFailures(1)
|
||||
//.HasJob<TestJob>(options => options.HasInterval(new TimeSpan(7, 0, 0, 0)));
|
||||
//
|
||||
//.HasJob<SyncronizeProducts>(options => options.HasInterval(new TimeSpan(24, 0, 0)))
|
||||
// .HasJob<ProcessWhiFitment>(options => options.HasInterval(new TimeSpan(24, 0, 0)));
|
||||
//.HasJob<ProcessWhiVehicles>(options => options.HasInterval(new TimeSpan(24, 0, 0))
|
||||
//.HasDependency<SyncronizeProducts>()
|
||||
//.HasJob<UpdateFitment>(options => options.HasInterval(new TimeSpan(24, 0, 0)));
|
||||
//.HasJob<UpdatePositioning>(options => options.HasInterval(new TimeSpan(24, 0, 0))
|
||||
// .HasDependency<UpdateFitment>()
|
||||
// .HasDependency<ProcessWhiFitment>()
|
||||
// .HasDependency<SyncronizeProducts>()
|
||||
// .StartsAt(DateTime.Today.AddHours(8))
|
||||
//) ;
|
||||
//.HasJob<StatusCheck>(options => options.HasInterval(new TimeSpan(24, 0, 0))
|
||||
// .StartsAt(DateTime.Parse("2021-04-01 08:00:00"))
|
||||
//)
|
||||
//.HasJob<ExecuteSsisPackages>(options =>
|
||||
// options.HasInterval(new TimeSpan(24, 0, 0))
|
||||
// //.StartsAt(DateTime.Today.AddHours(25))
|
||||
// )
|
||||
|
||||
.AddSingleton(builder.Configuration.GetSection("FtpServers:AzureConfiguration").Get<FtpConfiguration>())
|
||||
.AddSingleton<FtpService>()
|
||||
.AddSingleton<EmailService>()
|
||||
.AddSingleton<SsisService>()
|
||||
.AddSingleton<WhiSeoService>()
|
||||
.AddSingleton<VehicleService>()
|
||||
.AddSingleton<NexpartService>()
|
||||
.HasJob<UpdatePricing>(options => options.HasInterval(new TimeSpan(24, 0, 0))
|
||||
//.HasDependency<ExecuteSsisPackages>()
|
||||
// .StartsAt(DateTime.Today.AddHours(28))
|
||||
);
|
||||
//);
|
||||
//.AddApiServer();
|
||||
})
|
||||
|
||||
.AddAutoMapper(typeof(PartSourceProfile));
|
||||
})
|
||||
.ConfigureLogging((builder, logging) =>
|
||||
{
|
||||
logging.AddEventLog();
|
||||
logging.AddConsole();
|
||||
.AddSingleton<EmailService>()
|
||||
.AddSingleton<SsisService>()
|
||||
.AddSingleton<WhiSeoService>()
|
||||
.AddSingleton<VehicleService>()
|
||||
.AddSingleton<VehicleFitmentService>()
|
||||
.AddSingleton<NexpartService>()
|
||||
|
||||
//logging.AddProvider(new AutomationLoggerProvider());
|
||||
});
|
||||
}
|
||||
}
|
||||
.AddAutoMapper(typeof(PartSourceProfile));
|
||||
})
|
||||
.ConfigureLogging((builder, logging) =>
|
||||
{
|
||||
logging.AddEventLog();
|
||||
logging.AddConsole();
|
||||
|
||||
// logging.AddProvider(new AutomationLoggerProvider());
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user