Ejemplo n.º 1
0
        private static IConnection ConfigureRabbitMqConn()
        {
            var rabbitMqConfigs = new RabbitMqConfigs(_configs.GetSection("rabbitMq"));

            ConnectionFactory factory = new ConnectionFactory
            {
                HostName = rabbitMqConfigs.Host,
                Port     = rabbitMqConfigs.Port,
                UserName = rabbitMqConfigs.User,
                Password = rabbitMqConfigs.Password,
            };
            IConnection rabbitmqConn = factory.CreateConnection();

            return(rabbitmqConn);
        }
Ejemplo n.º 2
0
        private static RabbitMQ.Client.IConnection InitRabbitMqConn()
        {
            RabbitMqConfigs rabbitmqConfigs = new RabbitMqConfigs(_configs.GetSection("rabbitMq"));

            ConnectionFactory factory = new ConnectionFactory
            {
                HostName = rabbitmqConfigs.Host,
                Port     = rabbitmqConfigs.Port,
                UserName = rabbitmqConfigs.User,
                Password = rabbitmqConfigs.Password,
            };

            RabbitMQ.Client.IConnection rabbitmqConn = factory.CreateConnection();
            return(rabbitmqConn);
        }
Ejemplo n.º 3
0
        public Startup(IConfiguration config)
        {
            _config                   = config;
            _rabbitmqConfigs          = new RabbitMqConfigs(config.GetSection("rabbitMq"));
            _mongoDbLogsConfigs       = new MongoDbConfigs(config.GetSection("mongodb_logs_config"));
            _infoLogCollectionConfig  = new MongoCollectionConfig(config.GetSection("mongodb_logs_config").GetSection("infoLogCollection"));
            _errorLogCollectionConfig = new MongoCollectionConfig(config.GetSection("mongodb_logs_config").GetSection("errorLogCollection"));
            _emailConfirmUrlBase      = config["emailConfirmUrlBase"];

            _mongoDbUserSysDbConfigs              = new MongoDbConfigs(config.GetSection("mongodb_user_sys_db_config"));
            _accountsCollectionConfig             = new MongoCollectionConfig(config.GetSection("mongodb_user_sys_db_config").GetSection("accountsCollection"));
            _emailConfirmRequestsCollectionConfig = new MongoCollectionConfig(config.GetSection("mongodb_user_sys_db_config").GetSection("emailConfirmRequestsCollection"));
            _roleCollectionConfig = new MongoCollectionConfig(config.GetSection("mongodb_user_sys_db_config").GetSection("rolesCollection"));
            _userCollectionConfig = new MongoCollectionConfig(config.GetSection("mongodb_user_sys_db_config").GetSection("usersCollection"));
        }
Ejemplo n.º 4
0
        private static void LoadConfigs()
        {
            _configs = new ConfigurationBuilder()
                       .AddJsonFile(".//Settings//app-settings.json")
                       .AddJsonFile(".//Settings//mongodb-settings.json")
                       .AddJsonFile(".//Settings//rabbitmq-settings.json")
                       .Build();

            _mongoDbConfigs       = new MongoDbConfigs(_configs.GetSection("mongodb_logs_config"));
            _logsCollectionConfig = new MongoCollectionConfig(_configs.GetSection("mongodb_logs_config").GetSection("logsCollection"));

            _rabbitmqConfigs = new RabbitMqConfigs(_configs.GetSection("rabbitMq"));

            _mutexName = _configs["mutexName"];

            _mongoDbUserSysDbConfigs  = new MongoDbConfigs(_configs.GetSection("mongodb_user_sys_db_config"));
            _accountsCollectionConfig = new MongoCollectionConfig(_configs.GetSection("mongodb_user_sys_db_config").GetSection("accountsCollection"));
            _usersCollectionConfig    = new MongoCollectionConfig(_configs.GetSection("mongodb_user_sys_db_config").GetSection("usersCollection"));
            _rolesCollectionConfig    = new MongoCollectionConfig(_configs.GetSection("mongodb_user_sys_db_config").GetSection("rolesCollection"));
        }
Ejemplo n.º 5
0
        public Startup(IConfiguration config)
        {
            // For unit tests.
            if (config == null)
            {
                return;
            }

            _config          = config;
            _rTokenConfig    = new JwtConfig(config.GetSection("jwtRefreshToken"));
            _sTokenConfig    = new JwtConfig(config.GetSection("jwtShortToken"));
            _rTokenKeyConfig = new SymmetricKeyConfig(config.GetSection("jwtRefreshTokenSigningKey"));
            _sTokenKeyConfig = new SymmetricKeyConfig(config.GetSection("jwtShortTokenSigningKey"));
            _redisConfigs    = new RedisConfigs(config.GetSection("redis"));
            _rabbitmqConfigs = new RabbitMqConfigs(config.GetSection("rabbitMq"));
            _rabbitmqRevokedTokenExchangeConfigs = new RabbitMqExchangeConfigs(config.GetSection("rabbitMq").GetSection("revokedTokenExchange"));

            _mongoDbLogConfigs        = new MongoDbConfigs(config.GetSection("mongoLogDb"));
            _infoLogCollectionConfig  = new MongoCollectionConfig(config.GetSection("mongoLogDb").GetSection("infoLogCollection"));
            _errorLogCollectionConfig = new MongoCollectionConfig(config.GetSection("mongoLogDb").GetSection("errorLogCollection"));

            _mongoDbConfigs = new MongoDbConfigs(config.GetSection("mongoDb"));
            _accountRTokensCollectionConfig = new MongoCollectionConfig(config.GetSection("mongoDb").GetSection("accountRTokenCollection"));
        }