Ends in:
1 DAY
3 HRS
38 MIN
41 SEC
Ends in:
1 D
3 H
38 M
41 S
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();
    

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

    Hi,

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

Made with ❤️ on ABP v9.1.0-preview. Updated on November 29, 2024, 05:50