Example #1
0
        public void JsonConfigProvider()
        {
            var provider = new JsonConfigStore("./files/config.json");

            var config = provider.Read();

            Assert.AreEqual(4, config.Settings.Count());
            Assert.AreEqual(2, config.Settings.Where(x => x.Scope.Environment == "E2").Count());

            Assert.AreEqual("V4", config.Settings.Where(x => x.Scope.Environment == "E2")
                            .FirstOrDefault(x => x.Key == "K2").Definition);
        }
        public ConfigController()
        {
            if (_config == null)
            {
                string path = HostingEnvironment.MapPath(@"~/App_Data/example.json");

                var json = File.ReadAllText(path);

                var provider = new JsonConfigStore(json);

                _config = provider.Read();
            }
        }