public static ConfigStoresWriterSettings DefaultSettings(IEnvironment environment, string configName)
        {
            var userStore = ConfigStore.GetStore(ConfigStoreLocation.User, environment, configName);

            return(new ConfigStoresWriterSettings
            {
                EndpointsStore = userStore,
                ClientsStore = userStore,
                DefaultsStore = userStore,
                Environment = environment,
                ConfigurationName = configName
            });
        }
        private static IEnumerable <ConfigStore> GetStores(IEnvironment environment, [NotNull] string configName = ConfigurationNames.Default)
        {
            if (configName == null)
            {
                throw new ArgumentNullException(nameof(configName));
            }

            yield return(ConfigStore.GetStore(ConfigStoreLocation.CurrentDirectory, environment, configName));

            yield return(ConfigStore.GetStore(ConfigStoreLocation.User, environment, configName));

            yield return(ConfigStore.GetStore(ConfigStoreLocation.System, environment, configName));
        }
예제 #3
0
        protected ConfigStoresWriter GetStoresWriter()
        {
            var locationSettings  = GetStoreSettings();
            var environment       = new PowershellEnvironment(SessionState);
            var configurationName = GetConfigurationName();

            var writerSettings = new ConfigStoresWriterSettings
            {
                ConfigurationName = configurationName,
                ClientsStore      = ConfigStore.GetStore(locationSettings.Clients, environment, configurationName),
                DefaultsStore     = ConfigStore.GetStore(locationSettings.Defaults, environment, configurationName),
                EndpointsStore    = ConfigStore.GetStore(locationSettings.Endpoints, environment, configurationName)
            };


            return(new ConfigStoresWriter(writerSettings));
        }