Ejemplo n.º 1
0
        /// <summary>
        /// 服务注册与系统配置
        /// </summary>
        /// <param name="cfg"><see cref="IConfiguration"/></param>
        /// <param name="services"><see cref="IServiceCollection"/></param>
        /// <param name="env"><see cref="IWebHostEnvironment"/></param>
        /// <param name="serviceInfo"><see cref="ServiceInfo"/></param>
        public SharedServicesRegistration(IConfiguration cfg
                                          , IServiceCollection services
                                          , IWebHostEnvironment env
                                          , ServiceInfo serviceInfo)
        {
            _cfg         = cfg;
            _env         = env;
            _services    = services;
            _serviceInfo = serviceInfo;

            //读取Jwt配置
            _jwtConfig = _cfg.GetSection("JWT").Get <JWTConfig>();
            //读取mongodb配置
            _mongoConfig = _cfg.GetSection("MongoDb").Get <MongoConfig>();
            //读取mysql配置
            _mysqlConfig = _cfg.GetSection("Mysql").Get <MysqlConfig>();
            //读取redis配置
            _redisConfig = _cfg.GetSection("Redis").Get <RedisConfig>();
            //读取rabbitmq配置
            _rabbitMqConfig = _cfg.GetSection("RabbitMq").Get <RabbitMqConfig>();
            //读取consul配置
            _consulConfig = _cfg.GetSection("Consul").Get <ConsulConfig>();
            //读取是否开启SSOAuthentication(单点登录验证)
            _isSSOAuthentication = _cfg.GetValue("SSOAuthentication", false);
        }
Ejemplo n.º 2
0
        public SharedServicesRegistration(IConfiguration cfg
                                          , IServiceCollection services
                                          , IWebHostEnvironment env
                                          , ServiceInfo serviceInfo)
        {
            _cfg         = cfg;
            _env         = env;
            _services    = services;
            _serviceInfo = serviceInfo;

            _jwtConfig      = _cfg.GetSection("JWT").Get <JWTConfig>();
            _mongoConfig    = _cfg.GetSection("MongoDb").Get <MongoConfig>();
            _mysqlConfig    = _cfg.GetSection("Mysql").Get <MysqlConfig>();
            _redisConfig    = _cfg.GetSection("Redis").Get <RedisConfig>();
            _rabbitMqConfig = _cfg.GetSection("RabbitMq").Get <RabbitMqConfig>();
            _consulConfig   = _cfg.GetSection("Consul").Get <ConsulConfig>();
        }