Skip to content

Commit

Permalink
Added secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinOomenTheDeveloper committed Jun 1, 2024
1 parent 54f48c4 commit f37d777
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
24 changes: 21 additions & 3 deletions SessionService/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,20 @@
builder.Configuration.AddUserSecrets<Program>();
}

// Add services to the container.
builder.Services.AddControllers();
/*var MyAllowSpecificOrigins = "_myAllowSpecificOrigins";
builder.Services.AddCors(options =>
{
options.AddPolicy(name: MyAllowSpecificOrigins,
policy =>
{
policy.WithOrigins("*",
"*");
});
});*/

// Add services to the container.
builder.Services.AddControllers();
builder.Configuration.AddEnvironmentVariables();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
Expand All @@ -25,6 +37,7 @@
builder.Services.AddHostedService<TestService>();

var connectionString = builder.Configuration["AZURE_STORAGE_URL"];
Console.WriteLine(builder.Configuration["AZURE_STORAGE_URL"]);
builder.Services.AddSingleton(new AzureBlobService(connectionString));

Check warning on line 41 in SessionService/Program.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'connectionString' in 'AzureBlobService.AzureBlobService(string connectionString)'.

Check warning on line 41 in SessionService/Program.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'connectionString' in 'AzureBlobService.AzureBlobService(string connectionString)'.

var app = builder.Build();
Expand Down Expand Up @@ -92,6 +105,11 @@
}
});*/

/*app.UseCors(builder => builder
.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader());*/

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
Expand All @@ -107,7 +125,7 @@

app.Use(async (context, next) =>
{
context.Response.Headers.Add("Content-Security-Policy", "default-src 'self'; connect-src 'self' ws://localhost:5179");
context.Response.Headers.Add("Content-Security-Policy", "default-src 'self'; connect-src 'self' ws://session-service:5179");
await next();
});

Expand Down
2 changes: 1 addition & 1 deletion SessionService/Services/Event/EventService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public EventService(IConfiguration configuration)
{
var factory = new ConnectionFactory
{
HostName = configuration.GetConnectionString("rabbitmq")
HostName = configuration["RABBITMQ_HOST_NAME"]
};

connection = factory.CreateConnection();
Expand Down
9 changes: 9 additions & 0 deletions SessionService/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}

0 comments on commit f37d777

Please sign in to comment.