moved httpClient baseAddress to appsettings
This commit is contained in:
parent
2178ff54b6
commit
e72b4daf51
6 changed files with 15 additions and 3 deletions
|
@ -40,7 +40,7 @@ namespace DiscordBot
|
|||
|
||||
builder.Services.AddHttpClient(Constants.HTTP_CLIENT_NAME , httpClient =>
|
||||
{
|
||||
httpClient.BaseAddress = new Uri("https://localhost:7216/");
|
||||
httpClient.BaseAddress = new Uri(builder.Configuration["HttpClients:LiebWebsite"]);
|
||||
|
||||
httpClient.DefaultRequestHeaders.Add(
|
||||
HeaderNames.Accept, "application/vnd.github.v3+json");
|
||||
|
|
|
@ -4,5 +4,8 @@
|
|||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"HttpClients": {
|
||||
"LiebWebsite": "https://localhost:7216/"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,5 +5,8 @@
|
|||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
"AllowedHosts": "*",
|
||||
"HttpClients": {
|
||||
"LiebWebsite": "lieb-website"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ builder.Services.AddAuthorization(options =>
|
|||
|
||||
builder.Services.AddHttpClient(Constants.HttpClientName , httpClient =>
|
||||
{
|
||||
httpClient.BaseAddress = new Uri("http://localhost:5240/");
|
||||
httpClient.BaseAddress = new Uri(builder.Configuration["HttpClients:DiscordBot"]);
|
||||
|
||||
// using Microsoft.Net.Http.Headers;
|
||||
// The GitHub API requires two headers.
|
||||
|
|
|
@ -9,5 +9,8 @@
|
|||
"AllowedHosts": "*",
|
||||
"ConnectionStrings": {
|
||||
"LiebContext": "Data Source=./Database/mydb.sqlite;"
|
||||
},
|
||||
"HttpClients": {
|
||||
"DiscordBot": "http://localhost:5240/"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,5 +12,8 @@
|
|||
"AllowedHosts": "*",
|
||||
"ConnectionStrings": {
|
||||
"LiebContext": "Server=liebdb;Database=LiebContext;Uid=root;Pwd=my-secret-pw;"
|
||||
},
|
||||
"HttpClients": {
|
||||
"DiscordBot": "discord-bot"
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue