Skip to content

Commit

Permalink
Release v1.0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthur Bond committed Dec 4, 2019
1 parent 38797ed commit 654ca43
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 12 deletions.
21 changes: 20 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,26 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [1.0.4] - 2019-11-06
## [1.0.8] - 2019-12-04

### Fixed

- Calls to VBASE now use account and workspace from request headers rathen than env variables
- Infra service calls (vbase, apps) now use new `infra.io.vtex.com` domain

## [1.0.7] - 2019-12-04

### Fixed

- Republishing app to fix empty `plugins.json`

## [1.0.6] - 2019-11-27

### Fixed

- Republishing app to fix empty `plugins.json` (failed)

## [1.0.5] - 2019-11-06

### Added

Expand Down
6 changes: 4 additions & 2 deletions dotnet/DataSources/AppSettingsRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public class AppSettingsRepository : IAppSettingsRepository
{
private const string APP_SETTINGS = "vtex.reviews-and-ratings";
private const string HEADER_VTEX_CREDENTIAL = "X-Vtex-Credential";
private const string HEADER_VTEX_WORKSPACE = "X-Vtex-Workspace";
private const string HEADER_VTEX_ACCOUNT = "X-Vtex-Account";
private const string APPLICATION_JSON = "application/json";
private readonly IVtexEnvironmentVariableProvider _environmentVariableProvider;
private readonly IHttpContextAccessor _httpContextAccessor;
Expand Down Expand Up @@ -41,12 +43,12 @@ public AppSettingsRepository(IVtexEnvironmentVariableProvider environmentVariabl

public async Task<AppSettings> GetAppSettingAsync()
{
Console.WriteLine($"GetAppSettingAsync called with {this._environmentVariableProvider.Account},{this._environmentVariableProvider.Workspace},{this._environmentVariableProvider.ApplicationName},{this._environmentVariableProvider.ApplicationVendor},{this._environmentVariableProvider.Region}");
Console.WriteLine($"GetAppSettingAsync called with {this._httpContextAccessor.HttpContext.Request.Headers[HEADER_VTEX_ACCOUNT]},{this._httpContextAccessor.HttpContext.Request.Headers[HEADER_VTEX_WORKSPACE]},{this._environmentVariableProvider.ApplicationName},{this._environmentVariableProvider.ApplicationVendor},{this._environmentVariableProvider.Region}");

var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri($"http://apps.{this._environmentVariableProvider.Region}.vtex.io/{this._environmentVariableProvider.Account}/{this._environmentVariableProvider.Workspace}/apps/{APP_SETTINGS}/settings"),
RequestUri = new Uri($"http://infra.io.vtex.com/apps/v0/{this._httpContextAccessor.HttpContext.Request.Headers[HEADER_VTEX_ACCOUNT]}/{this._httpContextAccessor.HttpContext.Request.Headers[HEADER_VTEX_WORKSPACE]}/apps/{APP_SETTINGS}/settings"),
};

string authToken = this._httpContextAccessor.HttpContext.Request.Headers[HEADER_VTEX_CREDENTIAL];
Expand Down
14 changes: 8 additions & 6 deletions dotnet/DataSources/ProductReviewRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public class ProductReviewRepository : IProductReviewRepository
private const string REVIEWS_BUCKET = "productReviews";
private const string LOOKUP = "productLookup";
private const string HEADER_VTEX_CREDENTIAL = "X-Vtex-Credential";
private const string HEADER_VTEX_WORKSPACE = "X-Vtex-Workspace";
private const string HEADER_VTEX_ACCOUNT = "X-Vtex-Account";
private const string APPLICATION_JSON = "application/json";
private readonly IVtexEnvironmentVariableProvider _environmentVariableProvider;
private readonly IHttpContextAccessor _httpContextAccessor;
Expand Down Expand Up @@ -44,12 +46,12 @@ public ProductReviewRepository(IVtexEnvironmentVariableProvider environmentVaria

public async Task<IList<Review>> GetProductReviewsAsync(string productId)
{
Console.WriteLine($"GetProductReview called with {this._environmentVariableProvider.Account},{this._environmentVariableProvider.Workspace},{this._environmentVariableProvider.ApplicationName},{this._environmentVariableProvider.ApplicationVendor},{this._environmentVariableProvider.Region}");
Console.WriteLine($"GetProductReview called with {this._httpContextAccessor.HttpContext.Request.Headers[HEADER_VTEX_ACCOUNT]},{this._httpContextAccessor.HttpContext.Request.Headers[HEADER_VTEX_WORKSPACE]},{this._environmentVariableProvider.ApplicationName},{this._environmentVariableProvider.ApplicationVendor},{this._environmentVariableProvider.Region}");

var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri($"http://vbase.{this._environmentVariableProvider.Region}.vtex.io/{this._environmentVariableProvider.Account}/{this._environmentVariableProvider.Workspace}/buckets/{this._applicationName}/{REVIEWS_BUCKET}/files/{productId}"),
RequestUri = new Uri($"http://infra.io.vtex.com/vbase/v2/{this._httpContextAccessor.HttpContext.Request.Headers[HEADER_VTEX_ACCOUNT]}/{this._httpContextAccessor.HttpContext.Request.Headers[HEADER_VTEX_WORKSPACE]}/buckets/{this._applicationName}/{REVIEWS_BUCKET}/files/{productId}"),
};

string authToken = this._httpContextAccessor.HttpContext.Request.Headers[HEADER_VTEX_CREDENTIAL];
Expand All @@ -69,7 +71,7 @@ public async Task<IList<Review>> GetProductReviewsAsync(string productId)

response.EnsureSuccessStatusCode();

IList<Review> productReviews = JsonConvert.DeserializeObject<IList<Review>>(responseContent);
IList<Review> productReviews = JsonConvert.DeserializeObject<IList<Review>>(responseContent);
return productReviews;
}

Expand All @@ -86,7 +88,7 @@ public async Task SaveProductReviewsAsync(string productId, IList<Review> produc
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri($"http://vbase.{this._environmentVariableProvider.Region}.vtex.io/{this._environmentVariableProvider.Account}/{this._environmentVariableProvider.Workspace}/buckets/{this._applicationName}/{REVIEWS_BUCKET}/files/{productId}"),
RequestUri = new Uri($"http://infra.io.vtex.com/vbase/v2/{this._httpContextAccessor.HttpContext.Request.Headers[HEADER_VTEX_ACCOUNT]}/{this._httpContextAccessor.HttpContext.Request.Headers[HEADER_VTEX_WORKSPACE]}/buckets/{this._applicationName}/{REVIEWS_BUCKET}/files/{productId}"),
Content = new StringContent(jsonSerializedProducReviews, Encoding.UTF8, APPLICATION_JSON)
};

Expand All @@ -109,7 +111,7 @@ public async Task<IDictionary<int, string>> LoadLookupAsync()
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri($"http://vbase.{this._environmentVariableProvider.Region}.vtex.io/{this._environmentVariableProvider.Account}/{this._environmentVariableProvider.Workspace}/buckets/{this._applicationName}/{REVIEWS_BUCKET}/files/{LOOKUP}"),
RequestUri = new Uri($"http://infra.io.vtex.com/vbase/v2/{this._httpContextAccessor.HttpContext.Request.Headers[HEADER_VTEX_ACCOUNT]}/{this._httpContextAccessor.HttpContext.Request.Headers[HEADER_VTEX_WORKSPACE]}/buckets/{this._applicationName}/{REVIEWS_BUCKET}/files/{LOOKUP}"),
};

string authToken = this._httpContextAccessor.HttpContext.Request.Headers[HEADER_VTEX_CREDENTIAL];
Expand Down Expand Up @@ -145,7 +147,7 @@ public async Task SaveLookupAsync(IDictionary<int, string> lookupDictionary)
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri($"http://vbase.{this._environmentVariableProvider.Region}.vtex.io/{this._environmentVariableProvider.Account}/{this._environmentVariableProvider.Workspace}/buckets/{this._applicationName}/{REVIEWS_BUCKET}/files/{LOOKUP}"),
RequestUri = new Uri($"http://infra.io.vtex.com/vbase/v2/{this._httpContextAccessor.HttpContext.Request.Headers[HEADER_VTEX_ACCOUNT]}/{this._httpContextAccessor.HttpContext.Request.Headers[HEADER_VTEX_WORKSPACE]}/buckets/{this._applicationName}/{REVIEWS_BUCKET}/files/{LOOKUP}"),
Content = new StringContent(jsonSerializedLookup, Encoding.UTF8, APPLICATION_JSON)
};

Expand Down
13 changes: 10 additions & 3 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "reviews-and-ratings",
"vendor": "vtex",
"version": "1.0.5",
"version": "1.0.8",
"title": "Reviews and Ratings",
"description": "An app for saving and retrieving product reviews and ratings.",
"scripts": {
Expand Down Expand Up @@ -76,8 +76,15 @@
{
"name": "outbound-access",
"attrs": {
"host": "apps.{{region}}.vtex.io",
"path": "/{{account}}/{{workspace}}/apps/*"
"host": "infra.io.vtex.com",
"path": "/vbase/*"
}
},
{
"name": "outbound-access",
"attrs": {
"host": "infra.io.vtex.com",
"path": "/apps/*"
}
},
{
Expand Down

0 comments on commit 654ca43

Please sign in to comment.