Closed Zhaph closed 1 year ago
Hi, this seems like a reasonable thing to implement via config options, i'll have a look.
I'm adding a new service: ILicenseFileLoader
which will allow for loading/saving a license file to any storage location - for example Blob Storage.
There's one specific reason for this: When deploying with a zip deployment, the target files are entirely deleted upon deployment. This means that for subscription licenses, the .renewal file is wiped. By storing the license files in Blob Storage, this will fix this issue.
This will also mean that you can control the location of the license files if you want to use the physical file system. For example, in your composer you would now be able to do this:
builder.Services.AddSingleton<ILicenseFileLoader>(services => new PhysicalFileLicenseFileLoader(
services.GetRequiredService<IHostEnvironment>().MapPathContentRoot("~/ExamineX-Azure-Umbraco.lic")));
And can specify an overload to the PhysicalFileLicenseFileLoader
with alternativeLocations to look for the file.
I've also added another default implementation for Blob Storage. This will automatically be enabled depending on the configuration specified or the IOptions configured. For example, if this is specified in app.settings:
"ExamineXBlobLicenseFileOptions": {
"ConnectionString": "YOUR-CONNECTION-STRING-GOES-HERE",
"ContainerName": "YOUR-CONTAINER-NAME",
"ContainerRootPath": "OPTIONAL-ROOT-PATH-FOR-LICENSE-FILE",
"Disabled": false // Optional, set to true to disable this even if the connection string is set
}
Alternatively, if you are already using the blob media package, you could configure these IOptions in code so you aren't duplicating the configuration (if you wanted to use the same container):
builder.Services.AddSingleton<IConfigureOptions<ExamineXBlobLicenseFileOptions>>(
services => new ConfigureOptions<ExamineXBlobLicenseFileOptions>(options =>
{
var azureBlobFileSystemOptions = services.GetRequiredService<AzureBlobFileSystemOptions>();
options.ConnectionString = azureBlobFileSystemOptions.ConnectionString;
options.ContainerName = azureBlobFileSystemOptions.ContainerName;
options.ContainerRootPath = "ExamineX";
}));
This will be for ExamineX 4.1.0 which I'll release a beta for shortly.
Can probably close this one now that 4.1 is out.
With Umbraco v9, Umbraco's licensed products (Forms, Deploy) expect to find the license files in
/umbraco/Licenses/
.As we set and deploy license files as part of our CI/CD pipelines, it would be great if ExamineX could support this folder location as well as the root of the application.