public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            var json = JObject.Load(reader);

            var config = new AsimovConfig();
            serializer.Populate(json.CreateReader(), config);

            var self = GetSelf(json);
            if (self != null)
                serializer.Populate(self.CreateReader(), config);
            else
                Log.ErrorFormat("Could not find agent specific config / environment for: {0}", _machineName);

            var environments = config.Environment.Split(',');

            foreach (var environment in environments)
            {
                var envConfigFile = Path.Combine(_configDir, $"config.{environment.Trim()}.json");

                if (!File.Exists(envConfigFile))
                    continue;

                Log.DebugFormat("Loading config file {0}", envConfigFile);
				PopulateFromFile(envConfigFile, serializer, config);

				var env = new DeployEnvironment();
				PopulateFromFile(envConfigFile, serializer, env);
				config.Environments.Add(env);
			}

            return config;
        }
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            JObject json = JObject.Load(reader);

            var config = new AsimovConfig();
            serializer.Populate(json.CreateReader(), config);

            var self = GetSelf(json);
            if (self != null)
            {
                serializer.Populate(self.CreateReader(), config);
            }
            else
            {
                Log.ErrorFormat("Could not find agent specific config / environment for: {0}", _machineName);
            }

            var envConfigFile = Path.Combine(_configDir, string.Format("config.{0}.json", config.Environment));

            if (!File.Exists(envConfigFile))
                return config;

            Log.DebugFormat("Loading config file {0}", envConfigFile);

            using (var envReader = new StreamReader(envConfigFile))
            {
                using (var envJsonReader = new JsonTextReader(envReader))
                {
                    serializer.Populate(envJsonReader, config);
                }
            }

            return config;
        }