示例#1
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);
        }
示例#2
0
 /// <summary>
 /// Сервис для получения статистики из GIT репозиториев
 /// </summary>
 public GitStatisticsService(
     ILogger <GitStatisticsService> logger,
     IOptionsMonitor <StatisticsConfig> statisticsConfigMonitor,
     IOptionsMonitor <RepositoriesConfig> repositoriesConfig,
     IOptionsMonitor <WorkEstimateConfig> workEstimateConfig
     )
 {
     _logger             = logger;
     _statisticsConfig   = statisticsConfigMonitor.CurrentValue;
     _repositoriesConfig = repositoriesConfig.CurrentValue;
     _workEstimateConfig = workEstimateConfig.CurrentValue;
 }
        /// <summary>
        /// 配置Excel统计信息,只适用于纵向,不适用于横向统计
        /// </summary>
        /// <param name="name">统计信息名称,默认名称位置为最后一行第一个单元格</param>
        /// <param name="formula">单元格公式,如SUM、AVERAGE等,适用于垂直统计</param>
        /// <param name="columnIndexes">列索引统计。如果<paramref name="formula"/>是SUM,而<paramref name="columnIndexes"/>是[1,3],例如:列1和列3将是SUM第一行到最后一行。</param>
        /// <returns></returns>
        public FluentConfiguration <TEntity> HasStatistics(string name, string formula, params int[] columnIndexes)
        {
            var statistics = new StatisticsConfig()
            {
                Name    = name,
                Formula = formula,
                Columns = columnIndexes
            };

            _statisticsConfigs.Add(statistics);
            return(this);
        }
示例#4
0
        private void ReadGlobalConfig()
        {
            var data = _jsonConfigReader.Read(GlobalConfigFilename); // read the global config data.

            if (data == null)                                        // make sure it exists, else gracefully exists
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Couldn't read config/config.json! Make sure you rename config/config-example.json as config/config.json.");
                Console.ResetColor();

                Environment.Exit(-1);
            }

            StackConfig      = new StackConfig(data.stack);
            StatisticsConfig = new StatisticsConfig(data.statistics);
            WebServerConfig  = new WebServerConfig(data.website);
            LogConfig        = new LogConfig(data.logging);
        }
        public WebServerConfig(dynamic config)
        {
            try
            {
                // load the config data.
                Enabled       = config.enabled;
                BindInterface = string.IsNullOrEmpty(config.bind) ? "127.0.0.1" : config.bind;
                Port          = config.port == 0 ? 80 : config.port;
                Statistics    = new StatisticsConfig(config.stats);
                Backend       = new BackendConfig(config.backend);

                Valid = true;
            }
            catch (Exception e)
            {
                Valid = false;
                Log.Logger.ForContext <WebServerConfig>().Error(e, "Error loading web-server configuration");
            }
        }
示例#6
0
 /// <summary>
 /// 初始化一个<see cref="NpoiStatisticsAttribute"/>类型的实例
 /// </summary>
 public NpoiStatisticsAttribute()
 {
     StatisticsConfig = new StatisticsConfig();
 }