private void UseSeedData(string folderPath) { if (!string.IsNullOrWhiteSpace(folderPath) && Directory.Exists(folderPath)) { EnsureSeedData seeder = new EnsureSeedData(); seeder.EnsureSeedWalletData(Path.Combine(folderPath, "wallets.json")); seeder.EnsureSeedWalletTypeData(Path.Combine(folderPath, "walletTypes.json")); seeder.EnsureSeedOfferData(Path.Combine(folderPath, "offers.json")); seeder.EnsureSeedClientData(Path.Combine(folderPath, "clients.json")); seeder.EnsureSeedCurrencyData(Path.Combine(folderPath, "currency.json")); seeder.EnsurFiatSeedData(Path.Combine(folderPath, "fiat.json")); } }
public static void Main(string[] args) { Console.Title = "IdentityServer"; var seed = args.Contains("seed"); if (seed) { args = args.Except(new[] { "seed" }).ToArray(); } var host = CreateWebHostBuilder(args).Build(); EnsureSeedData seedData = new EnsureSeedData(); //seedData.EnsureSeedDataAsync(host.Services).Wait(); if (seed) { seedData.EnsureSeedDataAsync(host.Services).Wait(); } host.Run(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, EnsureSeedData seeder) { loggerFactory.AddConsole(_config.GetSection("Logging")); loggerFactory.AddDebug(); app.UseIdentity(); app.UseJwtBearerAuthentication(new JwtBearerOptions() { AutomaticAuthenticate = true, AutomaticChallenge = true, TokenValidationParameters = new TokenValidationParameters() { ValidIssuer = _config["Tokens:Issuer"], ValidAudience = _config["Tokens:Audience"], ValidateIssuerSigningKey = true, IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_config["Tokens:Key"])), ValidateLifetime = true } }); app.UseMvc(); seeder.ExecuteSeed().Wait(); }