Exemplo n.º 1
0
 public void Commit(bool reload)
 {
     // save unsaved settings
     if (_unsavedSettings.Count > 0)
     {
         _client.SaveAppSettings(_unsavedSettings, _applName);
     }
     // if requested load current settings
     // (only needed to resync external changes)
     if (reload)
     {
         _currentSettings = _client.LoadAppSettings(_applName);
     }
     _unsavedSettings = new NamedValueSet();
 }
Exemplo n.º 2
0
        public static void Load(ILogger logger, ICoreClient targetClient)
        {
            logger.LogDebug("Loading App Settings...");

            Assembly assembly = Assembly.GetExecutingAssembly();
            {
                const string prefix = "Orion.Configuration.AppSettings";
                Dictionary <string, string> chosenFiles = ResourceHelper.GetResources(assembly, prefix, "txt");

                int loadCount = 0;
                foreach (KeyValuePair <string, string> file in chosenFiles)
                {
                    string[] nameParts  = file.Key.Split('.');
                    var      properties = new NamedValueSet(file.Value);
                    string   name       = nameParts[5];
                    EnvId    env        = EnvHelper.ParseEnvName(nameParts[4]);
                    if (env == targetClient.ClientInfo.ConfigEnv)
                    {
                        targetClient.SaveAppSettings(properties, name, null, null, true, env);
                        loadCount++;
                    }
                }
                logger.LogDebug("Loaded {0} App Settings.", loadCount);
            }

            // load data exporter sql configs
            {
                // DEV default
                targetClient.SaveAppSettings(
                    GetPVSqlConnectionProps("sydwadqds01", null, "PortfolioValuer_DEV"),
                    "DataExportServer", null, null, true, EnvId.Dev_Development);
                // SIT default
                targetClient.SaveAppSettings(
                    GetPVSqlConnectionProps("sydwddqur02", null, "PortfolioValuer_SIT"),
                    "DataExportServer", null, null, true, EnvId.Sit_SystemTest);
                // STG default
                targetClient.SaveAppSettings(
                    GetPVSqlConnectionProps("sydwadbrl01", null, "PortfolioValuer_STG"),
                    "DataExportServer", null, null, true, EnvId.Stg_StagingLive);

                // -------------------- additional development machines --------------------
                // sydwcndb12s - Simon's machine
                targetClient.SaveAppSettings(
                    GetPVSqlConnectionProps("sydwadqds01", null, "PortfolioValuer_DEV"),
                    "DataExportServer", null, "sydwcndb12s", true, EnvId.Dev_Development);
                // sydw7jxjz1s - Mario's machine
                targetClient.SaveAppSettings(
                    GetPVSqlConnectionProps("sydwadqds01", null, "PortfolioValuer_DEV"),
                    "DataExportServer", null, "sydw7jxjz1s", true, EnvId.Dev_Development);
            }
        }