Ejemplo n.º 1
0
        public override void Configure(IFunctionsHostBuilder builder)
        {
            HttpPagamentoClient.Registrar(builder.Services, Environment.GetEnvironmentVariable("UrlBasePagamento"));

            builder.Services.AddSingleton <IPedidoPagamentoService, PedidoPagamentoService>();
            builder.Services.AddSingleton <IPagamentoHttpFactory, PagamentoHttpFactory>();
        }
Ejemplo n.º 2
0
        public void ConfigureServices(IServiceCollection services)
        {
            var key = Configuration.GetSection("JwtSettings:SigningKey").Value;

            services.AddAuthentication(x =>
            {
                x.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
                x.DefaultChallengeScheme    = JwtBearerDefaults.AuthenticationScheme;
            })
            .AddJwtBearer(x =>
            {
                x.RequireHttpsMetadata      = false;
                x.SaveToken                 = true;
                x.TokenValidationParameters = Token.TokenParametersConfig(key);
            });

            services.AddMediatR(typeof(Startup).Assembly);
            services.AddAutoMapper(typeof(CriarUsuarioHandler).Assembly);
            services.AddControllers().AddNewtonsoftJson();

            services.Configure <DronePontoInicialConfig>(Configuration.GetSection("BaseDrone"));
            services.AddApplicationInsightsTelemetry(Configuration["APPINSIGHTS_INSTRUMENTATIONKEY"]);

            HttpPagamentoClient.Registrar(services, Configuration["UrlBasePagamento"]);
            Swagger.Configurar(services);

            var producerConfig = new ProducerConfig();

            Configuration.Bind("Producer", producerConfig);

            services.Configure <MongoDbConfig>(Configuration.GetSection("Mongo"));

            DependencyContainer.RegisterServices(services, producerConfig);
        }