/// <summary> /// Copy ConfigCli.json to ConfigServer.json and validate ConnectionString exists. /// </summary> private void ConfigToServer() { ConfigCli.ConfigToServer(); var configCli = ConfigCli.Load(); var environment = configCli.EnvironmentGet(); if (UtilFramework.StringNull(environment.ConnectionStringFramework) == null || UtilFramework.StringNull(environment.ConnectionStringFramework) == null) { UtilCli.ConsoleWriteLineColor(string.Format("No ConnectionString for {0}! Set it with cli command: config connectionString", environment.EnvironmentName), ConsoleColor.Yellow); } }
/// <summary> /// Run command line interface. /// </summary> public void Run(string[] args) { Title(args); try { ConfigCli.Init(this); var configCli = ConfigCli.Load(); ConfigCli.Save(configCli); // Reset ConfigCli.json ConfigCli.ConfigToServer(); CommandEnvironment.ConsoleWriteLineCurrentEnvironment(configCli); commandLineApplication.Execute(args); ConfigToServer(); // Copy new values from ConfigCli.json to ConfigServer.json } catch (Exception exception) // For example unrecognized option { UtilCli.ConsoleWriteLineError(exception); Environment.ExitCode = 1; // echo %errorlevel% } }