Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            EnvVarHelper envVarHelper = new EnvVarHelper();

            envVarHelper.Delete("APPINSIGHTS_INSTRUMENTATIONKEY");

            envVarHelper.List();
        }
Ejemplo n.º 2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddCors(options =>
            {
                options.AddPolicy("AllowOrigin",
                                  builder =>
                {
                    builder.WithOrigins("http://localhost:8080",
                                        "http://galaxisdeploypatched-galaxis.e4ff.pro-eu-west-1.openshiftapps.com")
                    .AllowAnyHeader()
                    .AllowAnyMethod()
                    .AllowCredentials();
                });
            });

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            // localhost connection with the provided PostgreSQL docker-compose.yml
            // => "User Id=galaxis;Password=galaxis;Server=localhost;Port=5432;Database=galaxis;"
            services.AddDbContext <GalaxisDbContext>(options =>
                                                     options.UseNpgsql(EnvVarHelper.GetGalaxisDbConnectionString()));

            services.AddScoped <ITokenPriceHistoryProvider, TokenPriceHistoryProvider>();
            services.AddScoped <IFundPerformanceCalculator, FundPerformanceCalculator>();
            services.AddScoped <IFundRepository, FundRepository>();
            services.AddScoped <ICompanyRepository, CompanyRepository>();
            services.AddScoped <ITokenRepository, TokenRepository>();
            services.AddScoped <IPriceHistoryRepository, PriceHistoryRepository>();

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new OpenApiInfo {
                    Title = "Galaxis backend WebAPI", Version = "v1"
                });
            });
        }