Exemplo n.º 1
0
        /// <summary>
        /// Copy from file ConfigCli.json to ConfigServer.json
        /// </summary>
        public static void ConfigToServer()
        {
            // Console.WriteLine("Copy runtime specific values from ConfigCli to ConfigServer"); // There is also other values not needed for runtime like DeployAzureGitUrl.
            var configCli    = ConfigCli.Load();
            var configServer = ConfigServer.Load();

            // Environment
            configServer.EnvironmentName             = configCli.EnvironmentGet().EnvironmentName;
            configServer.IsUseDeveloperExceptionPage = configCli.EnvironmentGet().IsUseDeveloperExceptionPage;

            // ConnectionString
            configServer.ConnectionStringFramework   = configCli.EnvironmentGet().ConnectionStringFramework;
            configServer.ConnectionStringApplication = configCli.EnvironmentGet().ConnectionStringApplication;

            // Website
            configServer.WebsiteList.Clear();
            foreach (var webSite in configCli.WebsiteList)
            {
                configServer.WebsiteList.Add(new ConfigServerWebsite()
                {
                    DomainNameList = webSite.DomainNameList.Where(item => item.EnvironmentName == configCli.EnvironmentGet().EnvironmentName).Select(item => new ConfigServerWebsiteDomain {
                        DomainName = item.DomainName, AppTypeName = item.AppTypeName
                    }).ToList()
                });
            }

            ConfigServer.Save(configServer);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns ConnectionString of application or framework.
        /// </summary>
        public static string ConnectionString(bool isFrameworkDb)
        {
            var configCli = ConfigCli.Load();

            if (isFrameworkDb == false)
            {
                return(configCli.EnvironmentGet().ConnectionStringApplication);
            }
            else
            {
                return(configCli.EnvironmentGet().ConnectionStringFramework);
            }
        }