示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PoolConfig"/> class.
        /// </summary>
        /// <param name="config">The configuration.</param>
        /// <param name="coinConfig"></param>
        public PoolConfig(dynamic config, ICoinConfig coinConfig)
        {
            try
            {
                Enabled = config.enabled ? config.enabled : false;

                if (Enabled == false) // if the configuration is not enabled
                {
                    return;           // just skip reading rest of the parameters.
                }
                Coin = coinConfig;    // assign the coin config.

                // load the sections.
                Daemon   = new DaemonConfig(config.daemon);
                Meta     = new MetaConfig(config.meta);
                Wallet   = new WalletConfig(config.wallet);
                Rewards  = new RewardsConfig(config.rewards);
                Payments = new PaymentConfig(config.payments);
                Miner    = new MinerConfig(config.miner);
                Job      = new JobConfig(config.job);
                Stratum  = new StratumServerConfig(config.stratum);
                Banning  = new BanConfig(config.banning);
                Storage  = new RedisConfig(config.storage.redis);
                Vanilla  = new VanillaServerConfig(config.vanilla);

                Valid = true;
            }
            catch (Exception e)
            {
                Valid = false;
                Log.Logger.ForContext <PoolConfig>().Error(e, "Error loading pool configuration");
            }
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PoolConfig"/> class.
        /// </summary>
        /// <param name="config">The configuration.</param>
        /// <param name="coinConfig"></param>
        public PoolConfig(dynamic config, ICoinConfig coinConfig)
        {
            try
            {
                _logger = Log.ForContext <PoolConfig>().ForContext("Component", coinConfig.Name);

                Enabled = config.enabled ? config.enabled : false;

                if (Enabled == false) // if the configuration is not enabled
                {
                    return;           // just skip reading rest of the parameters.
                }
                Coin = coinConfig;    // assign the coin config.

                // load the sections.
                Daemon   = new DaemonConfig(config.daemon);
                Meta     = new MetaConfig(config.meta);
                Wallet   = new WalletConfig(config.wallet);
                Rewards  = new RewardsConfig(config.rewards);
                Payments = new PaymentConfig(config.payments);
                Miner    = new MinerConfig(config.miner);
                Job      = new JobConfig(config.job);
                Stratum  = new StratumServerConfig(config.stratum);
                Banning  = new BanConfig(config.banning);
                Storage  = new StorageConfig(config.storage);
                Vanilla  = new VanillaServerConfig(config.vanilla);

                // process extra checks
                if (Storage.Layer is MposStorageLayerConfig)
                {
                    if (Payments.Enabled)
                    {
                        Payments.Disable();
                        _logger.Information("Disabled payments processor as it can not be enabled when MPOS mode is on");
                    }
                }

                Valid = true;
            }
            catch (Exception e)
            {
                Valid = false;
                _logger.Error(e, "Error loading pool configuration");
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/javascript";
            string meta = context.Request["meta"] ?? "1";
            int    secondColumnWidth = 100;

            object data;

            if (meta == "1")
            {
                data = new List <object> {
                    new { ID = 1, StringField = "string", BooleanField = "boolean" },
                    new { ID = 2, StringField = "string", BooleanField = "boolean" },
                    new { ID = 3, StringField = "string", BooleanField = "boolean" },
                    new { ID = 4, StringField = "string", BooleanField = "boolean" },
                    new { ID = 5, StringField = "string", BooleanField = "boolean" }
                };
            }
            else
            {
                data = new List <object> {
                    new { ID = 1, DateField = DateTime.Now, NumberField = 472.96 },
                    new { ID = 2, DateField = DateTime.Now, NumberField = 472.96 },
                    new { ID = 3, DateField = DateTime.Now, NumberField = 472.96 },
                    new { ID = 4, DateField = DateTime.Now, NumberField = 472.96 },
                    new { ID = 5, DateField = DateTime.Now, NumberField = 472.96 }
                };

                secondColumnWidth = 350;
            }

            MetaConfig metaData = MetaConfig.From(data);

            metaData.Columns[1].Width = secondColumnWidth;
            metaData.IDProperty       = "ID";
            metaData.RootProperty     = "data";

            new StoreResponseData
            {
                Data     = JSON.Serialize(data),
                MetaData = metaData
            }.Return();
        }
示例#4
0
 public MetaService(IOptions <MetaConfig> metaConfig)
 {
     _metaConfig = metaConfig?.Value ?? throw new ArgumentNullException(nameof(metaConfig));
 }