private IReadOnlyDictionary GetVariables()

in tool/TeamCity.Docker/ConfigurationExplorer.cs [118:147]


        private IReadOnlyDictionary<string, string> GetVariables([NotNull] string configFile)
        {
            if (configFile == null)
            {
                throw new ArgumentNullException(nameof(configFile));
            }

            var vars = new Dictionary<string, string>();
            foreach (var line in _fileSystem.ReadLines(configFile))
            {
                var text = line.Trim();
                if (text.StartsWith('#') || text.Length < 3)
                {
                    continue;
                }

                var eq = text.IndexOf('=');
                if (eq < 1)
                {
                    continue;
                }

                var key = text.Substring(0, eq);
                var val = text.Substring(eq + 1);
                vars[key] = val;
                _logger.Details($"SET {key}={val}");
            }

            return vars;
        }