namespace MessengerApi.Configuration.Sources.Environment { public class EnvironmentConfigurationSource : IEnvironmentConfigurationSource { public bool HasKey(string key) { return !string.IsNullOrWhiteSpace(System.Environment.GetEnvironmentVariable(key)); } public T GetValue(string key) { if (typeof(T).Equals(typeof(Guid))) { var guid = Guid.Parse(System.Environment.GetEnvironmentVariable(key)); return (T)Convert.ChangeType(guid, typeof(T)); } return (T)Convert.ChangeType(System.Environment.GetEnvironmentVariable(key), typeof(T)); } } }