Example #1
0
        public void IndividualKeyBeRetrievedViaMappedConfigKey()
        {
            var source = new ConsulConfigurationSource()
                         .UseCache(new InMemoryEmergencyCache())
                         .MapKey("apps/myapp/myfeature", "consul:afeature");

            var consulState = new ConsulState();

            consulState = consulState.UpdateKVNode(new KeyValueNode("apps/myapp/myfeature", "myvalue"));

            var configProvider = _consul.LoadConfigProvider(source, consulState);

            VerifyConfigKey(configProvider, "consul:afeature", "myvalue");
        }
Example #2
0
        public void ConfigurationKeysBeRetrievedViaMappedConfigPrefix()
        {
            var source = new ConsulConfigurationSource()
                         .UseCache(new InMemoryEmergencyCache())
                         .MapConfigurationKey("apps/myapp/myconfig", "consulConf");

            var json = @"{""key1"":""value1"",""key2"": {
        ""key3"": {
            ""key4"": ""val4"",
            ""key5"": ""val5""
        }
    },}";

            var consulState = new ConsulState();

            consulState = consulState.UpdateKVNode(new KeyValueNode("apps/myapp/myconfig", json));

            var configProvider = _consul.LoadConfigProvider(source, consulState);

            VerifyConfigKey(configProvider, "consulConf", json);
        }
Example #3
0
        public void TryUpdateKeyWithSameValueDoesNotUpdate()
        {
            var consulState = _consulState.UpdateKVNode(new KeyValueNode("apps/setting1", "val1"));

            consulState.TryUpdateKVNode(new KeyValueNode("apps/setting1", "val1"), out var dontCare).Should().BeFalse();
        }