Skip to content

Commit

Permalink
App Startup (dotnet-architecture#34)
Browse files Browse the repository at this point in the history
* Adding ConfigureProduction as copy of ConfigureDevelopment.

* Configuring bundling and updating default appsetting value to work for local images (the setting is still useful for CDN scenarios).
  • Loading branch information
ardalis authored Aug 9, 2017
1 parent a8f150a commit f0c8f3e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
23 changes: 23 additions & 0 deletions src/Web/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,5 +149,28 @@ public void ConfigureDevelopment(IApplicationBuilder app,
var defaultUser = new ApplicationUser { UserName = "demouser@microsoft.com", Email = "demouser@microsoft.com" };
userManager.CreateAsync(defaultUser, "Pass@word1").Wait();
}

/// <summary>
/// Use this section to perform production-specific configuration.
/// In this case it is duplicating Development so that deployments to Azure will have sample data immediately.
/// </summary>
/// <param name="app"></param>
/// <param name="env"></param>
/// <param name="loggerFactory"></param>
/// <param name="userManager"></param>
public void ConfigureProduction(IApplicationBuilder app,
IHostingEnvironment env,
ILoggerFactory loggerFactory,
UserManager<ApplicationUser> userManager)
{
Configure(app, env);

//Seed Data
CatalogContextSeed.SeedAsync(app, loggerFactory)
.Wait();

var defaultUser = new ApplicationUser { UserName = "demouser@microsoft.com", Email = "demouser@microsoft.com" };
userManager.CreateAsync(defaultUser, "Pass@word1").Wait();
}
}
}
2 changes: 1 addition & 1 deletion src/Web/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"CatalogConnection": "Server=(localdb)\\ProjectsV13;Integrated Security=true;Initial Catalog=Microsoft.eShopOnWeb.CatalogDb;",
"IdentityConnection": "Server=(localdb)\\ProjectsV13;Integrated Security=true;Initial Catalog=Microsoft.eShopOnWeb.Identity;"
},
"CatalogBaseUrl": "http://localhost:5106",
"CatalogBaseUrl": "",
"Logging": {
"IncludeScopes": false,
"LogLevel": {
Expand Down
4 changes: 2 additions & 2 deletions src/Web/bundleconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// More info at https://go.microsoft.com/fwlink/?LinkId=808241
[
{
"outputFileName": "wwwroot/css/site.min.css",
"outputFileName": "wwwroot/css/app.min.css",
// An array of relative input file paths. Globbing patterns supported
"inputFiles": [
"wwwroot/css/site.css"
"wwwroot/css/app.css"
]
},
{
Expand Down
1 change: 1 addition & 0 deletions src/Web/wwwroot/css/app.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f0c8f3e

Please sign in to comment.