Adding configuration for static content's location customization#11
Adding configuration for static content's location customization#11jlchavez wants to merge 2 commits intodarnton:masterfrom
Conversation
…e on the client side for custom location of the static resource for a blazor app, it can be "./" as default for Virtual Apps or apps on the Root, to the root folder "/" if the app is on a subfolder, or "//static.shared.com/" for shared static content.
Added a NuGet package reference for `System.Reactive` (v6.0.2) to enable reactive programming capabilities in the project. Created a GitHub Actions workflow (`Darnton.Blazor.DeviceInterop.Build.yml`) to automate the build, packaging, and publishing process. The workflow includes: - Dependency restoration, project build, and NuGet package creation. - Publishing the package to GitHub Packages. - Optional steps for uploading artifacts and cleaning up generated files. This improves project automation and streamlines the distribution process.
There was a problem hiding this comment.
Pull Request Overview
This PR adds configuration support for customizable static content locations in a Blazor DeviceInterop library. The change allows developers to specify different base paths for static resources through appsettings.json configuration.
- Added IConfiguration dependency injection to GeolocationService for reading App:BasePath configuration
- Updated package version from 0.1.3 to 0.1.4 and added necessary NuGet dependencies
- Added sample appsettings.json configuration file and GitHub Actions workflow
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| Darnton.Blazor.DeviceInterop/Geolocation/GeolocationService.cs | Modified constructor to accept IConfiguration and use configurable base path for JavaScript file loading |
| Darnton.Blazor.DeviceInterop/Darnton.Blazor.DeviceInterop.csproj | Updated version numbers, added configuration abstractions package, and modified documentation settings |
| BlazorDeviceTestRig/wwwroot/appsettings.json | Added sample configuration file demonstrating the new App:BasePath setting |
| .github/workflows/Darnton.Blazor.DeviceInterop.Build.yml | Added GitHub Actions workflow for building and publishing the NuGet package |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| private readonly IConfiguration configuration; | ||
|
|
There was a problem hiding this comment.
The configuration field is assigned but never used after the constructor. Consider storing only the basePath value instead of the entire configuration object.
| private readonly IConfiguration configuration; |
| <PackageReference Include="Microsoft.AspNetCore.Components" Version="5.0.2" /> | ||
| <PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="5.0.2" /> | ||
| <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="5.0.0" /> | ||
| <PackageReference Include="System.Reactive" Version="6.0.2" /> |
There was a problem hiding this comment.
The System.Reactive package appears to be unrelated to the configuration changes being made. This addition should be explained or removed if not needed for the current changes.
| <PackageReference Include="System.Reactive" Version="6.0.2" /> |
| - name: Upload package as workflow artifact (optional) | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: Absractions |
There was a problem hiding this comment.
The artifact name contains a typo. 'Absractions' should be 'Abstractions'.
| name: Absractions | |
| name: Abstractions |
Adding configuration point (App:BasePath) in the appsettings.json file on the client side for custom location of the static resource for a blazor app, it can be "./" as default for Virtual Apps or apps on the Root, to the root folder "/" if the app is on a subfolder, or "//static.site.com/" for shared static content.
Samples settings in appsettings.json
For standard Location:
For root location:
For shared site: