Base solution for your next web application
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

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

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

    hi

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

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • 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
    );
    
    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    maliming created
    Support Team

    hi

    Maybe you can try this:

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    bulutyonetim created

    Hi,

    That was what I need thanks for helpping.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)