Add PicBaseUrl with a replaced parameter
This commit is contained in:
parent
96c55b8682
commit
f0f88aee98
@ -29,7 +29,7 @@ services:
|
|||||||
- ASPNETCORE_ENVIRONMENT=Development
|
- ASPNETCORE_ENVIRONMENT=Development
|
||||||
- ASPNETCORE_URLS=http://0.0.0.0:80
|
- ASPNETCORE_URLS=http://0.0.0.0:80
|
||||||
- ConnectionString=${ESHOP_AZURE_CATALOG_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word}
|
- ConnectionString=${ESHOP_AZURE_CATALOG_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word}
|
||||||
- PicBaseUrl=${ESHOP_AZURE_STORAGE_CATALOG:-http://localhost:5101/api/v1/pic/} #Local: You need to open your local dev-machine firewall at range 5100-5110.
|
- PicBaseUrl=${ESHOP_AZURE_STORAGE_CATALOG:-http://localhost:5101/api/v1/catalog/items/[0]/pic/} #Local: You need to open your local dev-machine firewall at range 5100-5110.
|
||||||
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
|
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
|
||||||
- AzureStorageAccountName=${ESHOP_AZURE_STORAGE_CATALOG_NAME}
|
- AzureStorageAccountName=${ESHOP_AZURE_STORAGE_CATALOG_NAME}
|
||||||
- AzureStorageAccountKey=${ESHOP_AZURE_STORAGE_CATALOG_KEY}
|
- AzureStorageAccountKey=${ESHOP_AZURE_STORAGE_CATALOG_KEY}
|
||||||
@ -70,7 +70,7 @@ services:
|
|||||||
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
|
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
|
||||||
- identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110.
|
- identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110.
|
||||||
- CampaignDetailFunctionUri=${ESHOP_AZUREFUNC_CAMPAIGN_DETAILS_URI}
|
- CampaignDetailFunctionUri=${ESHOP_AZUREFUNC_CAMPAIGN_DETAILS_URI}
|
||||||
- PicBaseUrl=${ESHOP_AZURE_STORAGE_MARKETING:-http://localhost:5110/api/v1/pic/}
|
- PicBaseUrl=${ESHOP_AZURE_STORAGE_MARKETING:-http://localhost:5110/api/v1/campaigns/[0]/pic/}
|
||||||
- AzureStorageAccountName=${ESHOP_AZURE_STORAGE_MARKETING_NAME}
|
- AzureStorageAccountName=${ESHOP_AZURE_STORAGE_MARKETING_NAME}
|
||||||
- AzureStorageAccountKey=${ESHOP_AZURE_STORAGE_MARKETING_KEY}
|
- AzureStorageAccountKey=${ESHOP_AZURE_STORAGE_MARKETING_KEY}
|
||||||
ports:
|
ports:
|
||||||
|
@ -34,7 +34,7 @@ services:
|
|||||||
- ASPNETCORE_ENVIRONMENT=Production
|
- ASPNETCORE_ENVIRONMENT=Production
|
||||||
ASPNETCORE_URLS=http://0.0.0.0:80
|
ASPNETCORE_URLS=http://0.0.0.0:80
|
||||||
- ConnectionString=${ESHOP_AZURE_CATALOG_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word}
|
- ConnectionString=${ESHOP_AZURE_CATALOG_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word}
|
||||||
- PicBaseUrl=${ESHOP_AZURE_STORAGE_CATALOG:-http://localhost:5101/api/v1/pic/} #Local: You need to open your local dev-machine firewall at range 5100-5110.
|
- PicBaseUrl=${ESHOP_AZURE_STORAGE_CATALOG} #Local: You need to open your local dev-machine firewall at range 5100-5110.
|
||||||
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
|
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
|
||||||
- AzureStorageAccountName=${ESHOP_AZURE_STORAGE_CATALOG_NAME}
|
- AzureStorageAccountName=${ESHOP_AZURE_STORAGE_CATALOG_NAME}
|
||||||
- AzureStorageAccountKey=${ESHOP_AZURE_STORAGE_CATALOG_KEY}
|
- AzureStorageAccountKey=${ESHOP_AZURE_STORAGE_CATALOG_KEY}
|
||||||
@ -75,7 +75,7 @@ services:
|
|||||||
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
|
- EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq}
|
||||||
- identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110.
|
- identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110.
|
||||||
- CampaignDetailFunctionUri=${ESHOP_AZUREFUNC_CAMPAIGN_DETAILS_URI}
|
- CampaignDetailFunctionUri=${ESHOP_AZUREFUNC_CAMPAIGN_DETAILS_URI}
|
||||||
- PicBaseUrl=${ESHOP_AZURE_STORAGE_MARKETING:-http://localhost:5110/api/v1/pic/}
|
- PicBaseUrl=${ESHOP_AZURE_STORAGE_MARKETING}
|
||||||
- AzureStorageAccountName=${ESHOP_AZURE_STORAGE_MARKETING_NAME}
|
- AzureStorageAccountName=${ESHOP_AZURE_STORAGE_MARKETING_NAME}
|
||||||
- AzureStorageAccountKey=${ESHOP_AZURE_STORAGE_MARKETING_KEY}
|
- AzureStorageAccountKey=${ESHOP_AZURE_STORAGE_MARKETING_KEY}
|
||||||
ports:
|
ports:
|
||||||
|
@ -237,8 +237,7 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
|
|||||||
{
|
{
|
||||||
catalogItem.PictureUri = _settings.AzureStorageEnabled
|
catalogItem.PictureUri = _settings.AzureStorageEnabled
|
||||||
? baseUri + catalogItem.PictureFileName
|
? baseUri + catalogItem.PictureFileName
|
||||||
: baseUri + catalogItem.Id;
|
: baseUri.Replace("[0]", catalogItem.Id.ToString());
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
|
@ -9,7 +9,6 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
|
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
|
||||||
{
|
{
|
||||||
[Route("api/v1/[controller]")]
|
|
||||||
public class PicController : Controller
|
public class PicController : Controller
|
||||||
{
|
{
|
||||||
private readonly IHostingEnvironment _env;
|
private readonly IHostingEnvironment _env;
|
||||||
@ -22,17 +21,18 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
|
|||||||
_catalogContext = catalogContext;
|
_catalogContext = catalogContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("{id}")]
|
[HttpGet]
|
||||||
|
[Route("api/v1/catalog/items/{catalogItemId:int}/pic")]
|
||||||
// GET: /<controller>/
|
// GET: /<controller>/
|
||||||
public async Task<IActionResult> GetImage(int id)
|
public async Task<IActionResult> GetImage(int catalogItemId)
|
||||||
{
|
{
|
||||||
if (id <= 0)
|
if (catalogItemId <= 0)
|
||||||
{
|
{
|
||||||
return BadRequest();
|
return BadRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
var item = await _catalogContext.CatalogItems
|
var item = await _catalogContext.CatalogItems
|
||||||
.SingleOrDefaultAsync(ci => ci.Id == id);
|
.SingleOrDefaultAsync(ci => ci.Id == catalogItemId);
|
||||||
|
|
||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"ConnectionString": "Server=tcp:127.0.0.1,5433;Initial Catalog=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word",
|
"ConnectionString": "Server=tcp:127.0.0.1,5433;Initial Catalog=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word",
|
||||||
"PicBaseUrl": "http://localhost:5101",
|
"PicBaseUrl": "http://localhost:5101/api/v1/catalog/items/[0]/pic/",
|
||||||
"UseCustomizationData": false,
|
"UseCustomizationData": false,
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"IncludeScopes": false,
|
"IncludeScopes": false,
|
||||||
|
@ -221,7 +221,7 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API.Controllers
|
|||||||
|
|
||||||
return _settings.AzureStorageEnabled
|
return _settings.AzureStorageEnabled
|
||||||
? baseUri + campaign.PictureName
|
? baseUri + campaign.PictureName
|
||||||
: baseUri + campaign.Id;
|
: baseUri.Replace("[0]", campaign.Id.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -5,12 +5,13 @@
|
|||||||
"Default": "Warning"
|
"Default": "Warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ConnectionString": "127.0.0.1",
|
"ConnectionString": "Server=tcp:127.0.0.1,5433;Initial Catalog=Microsoft.eShopOnContainers.Services.MarketingDb;User Id=sa;Password=Pass@word",
|
||||||
"MongoConnectionString": "mongodb://nosql.data",
|
"MongoConnectionString": "mongodb://nosql.data",
|
||||||
"MongoDatabase": "MarketingDb",
|
"MongoDatabase": "MarketingDb",
|
||||||
"IdentityUrl": "http://localhost:5105",
|
"IdentityUrl": "http://localhost:5105",
|
||||||
"ExternalCatalogBaseUrl": "http://localhost:5110",
|
"PicBaseUrl": "http://localhost:5110/api/v1/campaigns/[0]/pic/",
|
||||||
"AzureServiceBusEnabled": false,
|
"AzureServiceBusEnabled": false,
|
||||||
"SubscriptionClientName": "Marketing",
|
"SubscriptionClientName": "Marketing",
|
||||||
"AzureStorageEnabled": false
|
"AzureStorageEnabled": false
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user