Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

How to make Migrator project work with environment jsons #9609


User avatar
0
bulutyonetim created

What is your product version? 9.0.1 What is your product type (Angular or MVC)? Angular (single solution) What is product framework type (.net framework or .net core)? ASP.NET CORE


Hi what is best practise to make Migrator project work with environment jsons. I need a way to publish Migrator project to different environments each using it's own configuration.json

Thank you


4 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    hi

    You can refer to https://support.aspnetzero.com/QA/Questions/6110

  • User Avatar
    0
    bulutyonetim created

    Hi

    The post you referred did not helped me to solve this completely. I tried to get environment from command line in Pudux.Migrator.Main() like this:

    public static void Main(string[] args)
    {
        ParseArgs(args);
        //.............
     }
     
    private static void ParseArgs(string[] args)
    {
        if (args.IsNullOrEmpty())
        {
            return;
        }
    
        foreach (var arg in args)
        {
            if (arg == "-s")
            {
                _skipConnVerification = true;
            }
    
            if (arg.ToLower() == "-staging")
            {
                _env = "Staging";
            }
    
            if (arg.ToLower() == "-production")
            {
                _env = "Production";
            }
        }
    }
    

    But could not fine a way to pass _env to xxxMigratorModule constructure where asp.net zero is getting configuration settings. If I could pass it I can get desired configuration like this:

    _appConfiguration = AppConfigurations.Get(
        typeof(PuduxMigratorModule).GetAssembly().GetDirectoryPathOrNull(),
        environmentName,
        addUserSecrets: true
    );
    
  • User Avatar
    0
    maliming created
    Support Team

    hi

    Maybe you can try this:

  • User Avatar
    0
    bulutyonetim created

    Hi,

    That was what I need thanks for helpping.