From e3dcbe75e10deb29afc30db3c01c80eb2a48cb3a Mon Sep 17 00:00:00 2001 From: Josh Date: Sun, 26 Feb 2023 04:45:57 -0600 Subject: [PATCH] Allow environment variable expansion in config files (#689) * Allow environment variable expansion in config files * Remove extra newline --- ProjectLighthouse/Configuration/ConfigurationBase.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ProjectLighthouse/Configuration/ConfigurationBase.cs b/ProjectLighthouse/Configuration/ConfigurationBase.cs index bd082cc7..009f247c 100644 --- a/ProjectLighthouse/Configuration/ConfigurationBase.cs +++ b/ProjectLighthouse/Configuration/ConfigurationBase.cs @@ -165,6 +165,9 @@ public abstract class ConfigurationBase where T : class, new() continue; } + // Expand environment variables in strings. Format is windows-like (%ENV_NAME%) + if (propertyInfo.PropertyType == typeof(string)) value = Environment.ExpandEnvironmentVariables((string)value); + local.SetValue(this, value); } }