Exemple #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            string playersApiUrl = $"http://{Environment.GetEnvironmentVariable("POOLRANKING_PLAYERS_SERVICE_HOST")}:{Environment.GetEnvironmentVariable("POOLRANKING_PLAYERS_SERVICE_PORT")}";
            string matchesApiUrl = $"http://{Environment.GetEnvironmentVariable("POOLRANKING_MATCHES_SERVICE_HOST")}:{Environment.GetEnvironmentVariable("POOLRANKING_MATCHES_SERVICE_PORT")}";;
            string ratingApiUrl  = $"http://{Environment.GetEnvironmentVariable("POOLRANKING_RANKING_SERVICE_HOST")}:{Environment.GetEnvironmentVariable("POOLRANKING_RANKING_SERVICE_PORT")}";;

            services.AddCors(o => o.AddPolicy("AllowAll", corsBuilder =>
            {
                corsBuilder.AllowAnyOrigin()
                .AllowAnyMethod()
                .AllowAnyHeader();
            }));

            services.AddMvc();

            IMatchesApiClient matchApiClient  = Refit.RestService.For <IMatchesApiClient>(matchesApiUrl);
            IPlayersApiClient playerApiClient = Refit.RestService.For <IPlayersApiClient>(playersApiUrl);
            IRatingApiClient  ratingApiClient = Refit.RestService.For <IRatingApiClient>(ratingApiUrl);

            services.AddSingleton(matchApiClient);
            services.AddSingleton(playerApiClient);
            services.AddSingleton(ratingApiClient);

            services.AddSingleton <IPlayersService, PlayersService>();
            services.AddSingleton <IMatchesService, MatchesService>();
            services.AddSingleton <IScoreboardService, ScoreboardService>();
        }
 public MatchesService(IPlayersApiClient playersApiClient, IMatchesApiClient matchesApiClient, IRatingApiClient ratingApiClient)
 {
     this.playersApiClient = playersApiClient;
     this.matchesApiClient = matchesApiClient;
     this.ratingApiClient  = ratingApiClient;
 }
 public PlayersService(IPlayersApiClient playersApiClient, IRatingApiClient ratingApiClient)
 {
     this.playersApiClient = playersApiClient;
     this.ratingApiClient  = ratingApiClient;
 }
Exemple #4
0
 public ScoreboardService(IPlayersApiClient playersApiClient, IMatchesApiClient matchesApiClient)
 {
     this.playersApiClient = playersApiClient;
     this.matchesApiClient = matchesApiClient;
 }