public SettingsController()

in TailwindTraders.Website/Source/Tailwind.Traders.Web/Controllers/SettingsController.cs [14:31]


        public SettingsController(IOptionsSnapshot<Settings> settings, IConfiguration config)
        {
            _settings = settings.Value;
            if (!string.IsNullOrEmpty(_settings.SqlConnectionString))
            {
                var match = Regex.Match(_settings.SqlConnectionString, @"Server=(tcp:)?(?<servername>[^,;]+)");
                _settings.DebugInformation.SqlServerName = match.Groups["servername"].Value;
            }
            if (!string.IsNullOrEmpty(_settings.MongoConnectionString))
            {
                var match = Regex.Match(_settings.MongoConnectionString, @"//([^:]+:[^:]+@)?(?<servername>[^:/]+)");
                _settings.DebugInformation.MongoServerName = match.Groups["servername"].Value;
            }
            if (string.IsNullOrEmpty(_settings.ApplicationInsights.InstrumentationKey))
            {
                _settings.ApplicationInsights.InstrumentationKey = config["APPINSIGHTS_INSTRUMENTATIONKEY"];
            }
        }