Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 88d5dda9

Přidáno uživatelem Jaroslav Hrubý před asi 2 roky(ů)

docker-compose.yml testing CORS

Zobrazit rozdíly:

Backend/Backend/Program.cs
33 33
        new OpenApiInfo {Title = "AnnotationTool", Description = "KIV/ASWI ZČU Plzeň, 2022", Version = "0.1.1"});
34 34
});
35 35

  
36

  
37
builder.Services.AddCors();
38

  
36 39
// JWT authentication
37 40
var tokenValidationParams = JwtUtils.GetTokenValidationParameters(builder.Configuration);
38 41
builder.Services.AddSingleton(tokenValidationParams);
......
73 76
    app.UseSwaggerUI();
74 77
}
75 78

  
76
app.UseHttpsRedirection();
79
//app.UseHttpsRedirection();
77 80

  
78 81
// CORS
79
app.UseCors(x => x.WithOrigins(
80
        "http://localhost",
81
        "https://localhost:3000",
82
        "http://localhost:3000",
83
        "http://localhost:5007",
84
        "https://annotation.vlc3k.com")
85
    .SetIsOriginAllowedToAllowWildcardSubdomains()
86
    .AllowAnyHeader()
87
    .AllowAnyMethod()
88
    .AllowCredentials());
82
app.UseCors(builder => builder
83
                .AllowAnyHeader()
84
                .AllowAnyMethod()
85
                .SetIsOriginAllowed(_ => true)
86
                .AllowCredentials()
87
            );
88

  
89 89

  
90 90
// JWT Authentication
91 91
app.UseMiddleware<JwtMiddleware>();
......
97 97

  
98 98
// Logging
99 99
app.UseSerilogRequestLogging();
100
app.Logger.LogInformation("Starting up");
100
app.Logger.LogInformation("Starting up with CORS.....");
101 101

  
102 102
// Database seeding
103 103
using (var scope = app.Services.CreateScope())
docker-compose.yml
9 9
    ports:
10 10
      - '5432:5432'
11 11
    environment:
12
      - POSTGRES_DB=annotool
12
      - POSTGRES_DB=annotool-db
13 13
      - POSTGRES_USER=root
14 14
      - POSTGRES_PASSWORD=HEun3RGgEYwknRuk4adh4ZKW
15 15
      - PGDATA=/var/lib/postgresql/data/pgdata
......
22 22
      context: ./Backend
23 23
    ports:
24 24
      - '7241:7241'
25
      - '5241:5241'
25 26
    environment:
26
      - ConnectionString=Host=annotool-db:5432;Database=annotool;Username=root;Password=HEun3RGgEYwknRuk4adh4ZKW
27
      - ConnectionString=Host=annotool-db:5432;Database=annotool-db;Username=root;Password=HEun3RGgEYwknRuk4adh4ZKW
27 28
    depends_on:
28 29
      - db
29 30

  
......
32 33
    build:
33 34
      dockerfile: ./Dockerfile
34 35
      context: ./webapp
36
    environment:
37
      - ASWI_APP_BACKEND_URL=http://localhost:5241
35 38
    ports:
36 39
      - '5000:5000'
37 40

  

Také k dispozici: Unified diff