Ejemplo n.º 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, DubStatsContext db, IPackageManager p)
        {
            db.Database.Migrate();

            var package = p.GetPackageByNameOrNullAsync("jcli").Result;

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseStatusCodePages();
            }
            else
            {
                app.UseHsts();
            }

            app.UseStaticFiles();
            app.UseGraphQL <DubStatsSchema>("/graphql");
            app.UseGraphQLPlayground(new GraphQLPlaygroundOptions
            {
                PlaygroundSettings = new Dictionary <string, object> {
                    { "request.credentials", "same-origin" }
                }
            });
            app.UseRouting();
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
Ejemplo n.º 2
0
        public DubRegistryStatFetcher(
            DubStatsContext db,
            ILogger <DubRegistryStatFetcher> logger,
            IWeekManager weeks,
            IUpdateManager updates
            )
        {
            this._db      = db;
            this._logger  = logger;
            this._weeks   = weeks;
            this._updates = updates;

            this._client             = new HttpClient();
            this._client.BaseAddress = Constants.STAT_FETCHER_BASE_ADDRESS;
            this._client.DefaultRequestHeaders.Add("user-agent", Constants.STAT_FETCHER_USER_AGENT);
        }
Ejemplo n.º 3
0
 public UpdateManager(DubStatsContext db, ILogger <UpdateManager> logger)
 {
     this._db     = db;
     this._logger = logger;
 }
Ejemplo n.º 4
0
 public WeekManager(DubStatsContext db)
 {
     this._db = db;
 }