Skip to content

Fix problem with HttpClient#7

Merged
BekAllaev merged 11 commits into
masterfrom
dev
Feb 25, 2026
Merged

Fix problem with HttpClient#7
BekAllaev merged 11 commits into
masterfrom
dev

Conversation

@BekAllaev

Copy link
Copy Markdown
Owner

This pull request introduces several improvements to the deployment workflow and configuration management for the OMSBlazor application, focusing on environment-based deployments and more robust configuration handling for backend URLs. The main themes are: (1) enhanced GitHub Actions workflow for multi-environment deployment, (2) improved configuration of backend URLs per environment, and (3) refactoring of HTTP client setup for both frontend and backend projects.

Deployment Workflow Enhancements:

  • The GitHub Actions workflow (.github/workflows/deploy-oms.yml) now supports deployments from both master and dev branches, with dynamic selection of configuration (Release for master, Staging for dev) and Azure WebApp names based on the branch. This enables seamless staging and production deployments. [1] [2] [3] [4] [5] [6]

Configuration Management:

  • Environment-specific appsettings.*.json files are added for both frontend and backend projects, each specifying the appropriate BackendUrl for Development, Staging, and Production. The default BackendUrl in appsettings.json is now empty, enforcing explicit configuration per environment. [1] [2] [3] [4] [5]

HTTP Client Setup Refactoring:

  • Both frontend (src/OMSBlazor.Client/Program.cs) and backend (src/OMSBlazor/Program.cs) projects now use IHttpClientFactory with named/default clients, retrieving the BackendUrl from configuration and throwing clear exceptions if missing. This replaces the previous approach of directly instantiating HttpClient with a hardcoded or potentially missing URL. [1] [2]
  • Redundant or repetitive HTTP client registrations for specific view models in the backend have been removed, simplifying the DI setup.
  • The StatisticsDataReader service now uses the default HTTP client name for consistency. [1] [2]

Project File Adjustments:

  • The frontend project (OMSBlazor.Client.csproj) is updated to ensure the staging appsettings file is copied to the output directory, supporting correct environment configuration during deployment.
  • The backend project (OMSBlazor.csproj) is adjusted to ensure appsettings.json is always copied to the output directory.

These changes collectively improve deployment flexibility, configuration safety, and maintainability across multiple environments.

BekAllaev and others added 11 commits February 24, 2026 15:31
Refactored HttpClient registration to use IHttpClientFactory with a named client and centralized base address configuration via "BackendUrl" from appsettings. Updated all environments to include the correct "BackendUrl" value. Removed redundant HttpClient registrations in ViewModels and improved error handling for missing configuration. Adjusted project file to ensure appsettings.json is copied to output but not publish directory. Made minor namespace and using directive updates.
Co-authored-by: BekAllaev <37025308+BekAllaev@users.noreply.github.com>
Co-authored-by: BekAllaev <37025308+BekAllaev@users.noreply.github.com>
…-dev

Add stage CI/CD pipeline for dev branch using Staging configuration
Delete yml file in the dev that is mentioned for master
Remove section - permission
Added appsettings.Staging.json with staging BackendUrl.
Updated OMSBlazor.Client.csproj to copy the staging config file
to the output directory during build and publish.
@BekAllaev BekAllaev merged commit 09a5c45 into master Feb 25, 2026
0 of 2 checks passed
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