Skip to content

Adding configuration for static content's location customization#11

Open
jlchavez wants to merge 2 commits intodarnton:masterfrom
jlchavez:master
Open

Adding configuration for static content's location customization#11
jlchavez wants to merge 2 commits intodarnton:masterfrom
jlchavez:master

Conversation

@jlchavez
Copy link

@jlchavez jlchavez commented May 5, 2023

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:

{
  "App": {
    "BasePath": "./"
  }
}

For root location:

{
  "App": {
    "BasePath": "/"
  }
}

For shared site:

{
  "App": {
    "BasePath": "static.site.com"
  }
}

jlchavez added 2 commits May 4, 2023 19:21
…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.
Copilot AI review requested due to automatic review settings September 30, 2025 01:45
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +18 to 19
private readonly IConfiguration configuration;

Copy link

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The configuration field is assigned but never used after the constructor. Consider storing only the basePath value instead of the entire configuration object.

Suggested change
private readonly IConfiguration configuration;

Copilot uses AI. Check for mistakes.
<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" />
Copy link

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
<PackageReference Include="System.Reactive" Version="6.0.2" />

Copilot uses AI. Check for mistakes.
- name: Upload package as workflow artifact (optional)
uses: actions/upload-artifact@v4
with:
name: Absractions
Copy link

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The artifact name contains a typo. 'Absractions' should be 'Abstractions'.

Suggested change
name: Absractions
name: Abstractions

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants