Exemplo n.º 1
0
        public WebServerConfig(dynamic config)
        {
            try
            {
                // set the defaults;
                BindInterface = "127.0.0.1";
                Port = 80;

                // load the config data.
                Enabled = config.enabled;
                BindInterface = config.bind;
                Port = config.port;
                Statistics = new StatisticsConfig(config.stats);

                Valid = true;
            }
            catch (Exception e)
            {
                Valid = false;
                Log.Logger.ForContext<WebServerConfig>().Error(e, "Error loading web-server configuration");
            }
        }
Exemplo n.º 2
0
        private void LoadGlobalConfig()
        {
            var data = _jsonConfigReader.Read(GlobalConfigFilename); // read the global config data.

            // make sure we were able to load global config.
            if (data == null)
            {
                // gracefully exit
                _logger.Error("Couldn't read config/config.json! Make sure you rename config/config-example.json as config/config.json.");
                Environment.Exit(-1);
            }

            // load log config.
            LogConfig = new LogConfig(data.logging); // read the log config first, so rest of the config loaders can use log subsystem.
            _logManager.EmitConfiguration(LogConfig); // assign the log configuration to log manager.

            // print a version banner.
            _logger.Information("CoiniumServ {0:l} {1:l} warming-up..", VersionInfo.CodeName, Assembly.GetAssembly(typeof(Program)).GetName().Version);
            PlatformManager.PrintPlatformBanner();

            // load rest of the configs.
            StackConfig = new StackConfig(data.stack);
            StatisticsConfig = new StatisticsConfig(data.statistics);
            WebServerConfig = new WebServerConfig(data.website);
        }