Example #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMemoryCache();

            services.AddMvc(options =>
            {
                options.ModelMetadataDetailsProviders.Add(new SuppressChildValidationMetadataProvider(typeof(BitcoinAddress)));
            })
            .AddControllersAsServices();

            // Register the Swagger generator, defining one or more Swagger documents
            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc($"v{Constants.BackendMajorVersion}", new Info
                {
                    Version     = $"v{Constants.BackendMajorVersion}",
                    Title       = "Wasabi Wallet API",
                    Description = "Privacy focused, ZeroLink compliant Bitcoin Web API.",
                    License     = new License {
                        Name = "Use under MIT.", Url = "https://github.com/zkSNACKs/WalletWasabi/blob/master/LICENSE.md"
                    }
                });

                // Set the comments path for the Swagger JSON and UI.
                var basePath = AppContext.BaseDirectory;
                var xmlPath  = Path.Combine(basePath, "WalletWasabi.Backend.xml");
                c.IncludeXmlComments(xmlPath);
            });

            services.AddLogging(Logging => Logging.AddFilter((s, level) => level >= Microsoft.Extensions.Logging.LogLevel.Warning));

            services.AddSingleton <IExchangeRateProvider>(new ExchangeRateProvider());

            services.AddResponseCompression();
        }
Example #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMemoryCache();
            services.AddMvc();

            // Register the Swagger generator, defining one or more Swagger documents
            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new Info
                {
                    Version     = "v1",
                    Title       = "Wasabi Wallet API",
                    Description = "Privacy oriented Bitcoin Web API.",
                    License     = new License {
                        Name = "Use under MIT.", Url = "https://github.com/zkSNACKs/WalletWasabi/blob/master/LICENSE.md"
                    }
                });

                // Set the comments path for the Swagger JSON and UI.
                var basePath = AppContext.BaseDirectory;
                var xmlPath  = Path.Combine(basePath, "WalletWasabi.Backend.xml");
                c.IncludeXmlComments(xmlPath);
            });

            services.AddLogging(Logging => Logging.AddFilter((s, level) => level >= Microsoft.Extensions.Logging.LogLevel.Warning));

            services.AddSingleton <IExchangeRateProvider>(new ExchangeRateProvider());
        }
Example #3
0
        public static IHostBuilder CreateHostBuilder(string[] args) =>
        Host.CreateDefaultBuilder(args)
        .ConfigureLogging(Logging =>
        {
            Logging.AddFilter("System", LogLevel.None);
            Logging.AddFilter("Microsoft", LogLevel.None);

            Logging.AddLog4Net();
        })
        .ConfigureWebHostDefaults(webBuilder =>
        {
            webBuilder.UseStartup <Startup>();
        });