Open Closed

how to use environment specific ocelot file in WebGateway #6152


User avatar
0
smansuri created

Provide us with the following info:

  • ABP Framework version: v7.3.2

  • UI Type: Angular

  • Database System: EF Core ( MySQL)

  • Tiered (for MVC) or Auth Server Separated (for Angular): Auth server separated angular

  • Exception message and full stack trace: wrong ocelot file used

  • Steps to reproduce the issue: im trying to create a separated ocelot file for QA environment as "ocelot.QA.json" and reference it in program.cs file as below. but after deploying the docker in QA environment it still uses ocelot.json file only. im setting the environment variable while running the docker with "-e ASPNETCORE_ENVIRONMENT='QA'" parameter.

  • builder.Host .AddAppSettingsSecretsJson() //.AddOcelotJson(path:AppOcelotJsonPath)//Adding this change to pick up the ocelot file bases on the environment eg - QA,PROD etc. //.AddOcelotJson() .UseAutofac() .UseSerilog();

         if (!builder.Environment.IsDevelopment()) {
                 //Console.WriteLine(builder.Environment.EnvironmentName);
                 AppOcelotJsonPath = $"ocelot.{builder.Environment.EnvironmentName}.json"; }
                 builder.Configuration.SetBasePath(builder.Environment.ContentRootPath).AddJsonFile(AppOcelotJsonPath, optional: false, reloadOnChange: true);
    
         builder.Host.AddOcelotJson(path:AppOcelotJsonPath);
         await builder.AddApplicationAsync<healthWebGatewayModule>();
         var app = builder.Build();
    
Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

1 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Fullstack Developer

    Hi,

    What's the environment value? you can check it in the log files.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on October 05, 2026, 11:32
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.