0
    
    
        
                    dev_marcelo created
                    
                    
                    
                
                Just as recomendation to improve Abp.io
- ABP Framework version: 8.1.1
 - UI Type: Angular
 - Database System: EF Core (SQL Server)
 - Tiered (for MVC) or Auth Server Separated (for Angular): yes
 
I am facing problems when publishing gateways to different environments, because I have:
- yarp.json for local environment or development
 - yarp.Stage.json for Stage or QA
 - yarp.Production.json for Production
 
using Microsoft.Extensions.Configuration;
namespace Microsoft.Extensions.Hosting;
public static class AbpHostingHostBuilderExtensions
{
    public const string AppYarpJsonPath = "yarp.json";
    public static IHostBuilder AddYarpJson(
        this IHostBuilder hostBuilder,
        bool optional = true,
        bool reloadOnChange = true,
        string path = AppYarpJsonPath)
    {
        return hostBuilder.ConfigureAppConfiguration((_, builder) =>
        {
            builder.AddJsonFile(
                path: AppYarpJsonPath, // should be path
                optional: optional,
                reloadOnChange: reloadOnChange
            );
        });
    }
}
so I could use from program.cs on gateway
.AddYarpJson(path: $"yarp.{builder.Environment.EnvironmentName}.json")
but even better should be
public static IHostBuilder AddYarpJson(
    this IHostBuilder hostBuilder,
    bool optional = true,
    bool reloadOnChange = true,
    string path = AppYarpJsonPath)
{
    return hostBuilder.ConfigureAppConfiguration((context, builder) =>
    {
        builder.AddJsonFile(
            path: path,
            optional: optional,
            reloadOnChange: reloadOnChange
        );
        builder.AddJsonFile(
            path: $"yarp.{context.HostingEnvironment.EnvironmentName}.json",
            optional: optional,
            reloadOnChange: reloadOnChange
        );
    });
}
                        1 Answer(s)
- 
    0
Hi,
Thanks for your suggestion, we will improve the template