Skip to content

Commit

Permalink
Merge pull request #19 from bc-jcha/MERC-5890
Browse files Browse the repository at this point in the history
MERC-5890 Change naming WIDGET_BUILDER_STORE_HASH
  • Loading branch information
pedelman authored Dec 10, 2019
2 parents e447f07 + edd27f4 commit 0d1cb70
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ The widget builder reads the credentials from environment variables. You will ne
- `WIDGET_BUILDER_AUTH_ID` - The primary identifier of this set of credentials (Client ID).
- `WIDGET_BUILDER_AUTH_TOKEN` - The private authorization token (Auth token).

- `WIDGET_BUILDER_STORE_ID` - The primary hash identifier of the store the credentials belong to.
- `WIDGET_BUILDER_STORE_HASH` - The primary hash identifier of the store the credentials belong to.

You can also run using a format like the following:

```
WIDGET_BUILDER_AUTH_ID=REDACTED WIDGET_BUILDER_AUTH_TOKEN=REDACTED WIDGET_BUILDER_STORE_ID=REDACTED widget-builder
WIDGET_BUILDER_AUTH_ID=REDACTED WIDGET_BUILDER_AUTH_TOKEN=REDACTED WIDGET_BUILDER_STORE_HASH=REDACTED widget-builder
```

### Running the builder
Expand Down
2 changes: 1 addition & 1 deletion src/services/api/widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function getWidget(data: WidgetPreviewRenderRequest): Promise<string> {
'X-Auth-Token': AUTH_CONFIG.authToken,
},
data,
url: widgetApi.widgetPreviewRender(AUTH_CONFIG.storeId as string),
url: widgetApi.widgetPreviewRender(AUTH_CONFIG.storeHash as string),
}).then((response: AxiosResponse<WidgetPreviewRenderResponse>) => {
resolve(response.data.data.html);
}).catch((err: Error) => reject(err));
Expand Down
4 changes: 2 additions & 2 deletions src/services/auth/auth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import checkCredentials from './checkAuth';
describe('Auth credential status check', () => {
it('succeeds if credentials are present', () => {
const checkStatus = checkCredentials({
storeId: '123456',
storeHash: '123456',
authId: 'abc123',
authToken: 'xyz456',
});
Expand All @@ -13,7 +13,7 @@ describe('Auth credential status check', () => {

it('fails if any of the credentials are missing', () => {
const checkStatus = checkCredentials({
storeId: '123456',
storeHash: '123456',
authId: 'abc123',
authToken: '',
});
Expand Down
4 changes: 2 additions & 2 deletions src/services/auth/authConfig.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
export interface AuthConfig {
storeId?: string;
storeHash?: string;
authId?: string;
authToken?: string;
}

const AUTH_CONFIG: AuthConfig = {
storeId: process.env.WIDGET_BUILDER_STORE_ID,
storeHash: process.env.WIDGET_BUILDER_STORE_HASH,
authId: process.env.WIDGET_BUILDER_AUTH_ID,
authToken: process.env.WIDGET_BUILDER_AUTH_TOKEN,
};
Expand Down

0 comments on commit 0d1cb70

Please sign in to comment.