Using local Media folder when not in Production Environment
Hi, I don't have the best of luck getting help on this forum, but anyhow, I have our Umbraco 12 site setup to use an Azure Blog Storage Container.
I can't find information on setting the site to use the local /media folder instead, when developing locally. Or, is my only choice to create another Blog Container so that back-office testing of media images and files doesn't do anything to production versions?
If you comment out: .AddAzureBlobMediaFileSystem() and/or .AddAzureBlobImageSharpCache() in your startup.cs, Umbraco should use the local Media folder.
You could automate this by adding an if statement to the ConfigureServices() method of your Startup.cs:
public void ConfigureServices(IServiceCollection services)
{
var umbracoBuilder = services.AddUmbraco(_env, _config)
.AddBackOffice()
.AddWebsite()
.AddComposers();
if (!_env.IsDevelopment())
{
umbracoBuilder.AddAzureBlobMediaFileSystem()
.AddAzureBlobImageSharpCache();
}
umbracoBuilder.Build();
}
Here the blob storage middleware is only registered if you are not running the Development environment.
(_env is IWebHostEnvironment, which should already be injected in your constructor)
Using local Media folder when not in Production Environment
Hi, I don't have the best of luck getting help on this forum, but anyhow, I have our Umbraco 12 site setup to use an Azure Blog Storage Container.
I can't find information on setting the site to use the local /media folder instead, when developing locally. Or, is my only choice to create another Blog Container so that back-office testing of media images and files doesn't do anything to production versions?
Thanks, Jason
If you comment out:
.AddAzureBlobMediaFileSystem()
and/or.AddAzureBlobImageSharpCache()
in your startup.cs, Umbraco should use the local Media folder.You could automate this by adding an if statement to the ConfigureServices() method of your Startup.cs:
Here the blob storage middleware is only registered if you are not running the Development environment.
(
_env
isIWebHostEnvironment
, which should already be injected in your constructor)Thank you! That's what I was looking for.
is working on a reply...