Skip to content

Commit 572949a

Browse files
committed
add some info about env variables and how to create new marketplaces
1 parent f2532d3 commit 572949a

File tree

1 file changed

+76
-40
lines changed

1 file changed

+76
-40
lines changed

README.md

Lines changed: 76 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22

33
- [Getting Started](#getting-started)
44
- [Environment Variables](#environment-variables)
5+
- [Creating the marketplace app](#creating-the-marketplace-app)
6+
- [Provider ID](#provider-id)
57
- [Authentication](#authentication)
68
- [User Credentials](#user-credentials)
79
- [Provider Credentials](#provider-credentials)
810
- [Webstore Component Library](#webstore-component-library)
911
- [Upgrading To The Latest Version](#upgrading-to-the-latest-version)
1012
- [Component Library Dev Mode](#component-library-dev-mode)
13+
- [Exception Handling](#exception-handling)
1114
- [Linting](#linting)
1215
- [Testing](#testing)
1316
- [Jest](#jest)
@@ -31,51 +34,45 @@
3134
3235
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages. -->
3336

34-
## Webstore Component Library
35-
The webstore requires a [React component library](https://reactjs.org/docs/react-component.html) of view components. That dependency is packaged and released independently.
36-
37-
#### Upgrading To The Latest Version
38-
In the terminal:
39-
``` bash
40-
# first check for whether there is an updated version
41-
yarn outdated @scientist-softserv/webstore-component-library # check the values under "current" and "latest"
42-
43-
# if there's an updated version
44-
yarn upgrade @scientist-softserv/webstore-component-library --latest
45-
```
46-
47-
#### Component Library Dev Mode
48-
Using the local github repository requires you to manually clone the component library to your computer, build, and link it:
49-
50-
Preparing your local copy of the component library:
51-
52-
git clone https://github.com/scientist-softserv/webstore-component-library.git
53-
cd webstore-component-library
54-
npm install
55-
yarn link # now there is a magic symlink in `~/.config/yarn/link` usable by the webstore app
56-
57-
If there are changes to the component library, you will need to rebuild in order to get the newest changes. You can either rebuild manually after changes are made, or have the webstore continually "watch" for changes:
58-
59-
npm run build-lib # for a onetime build
60-
npm run watch-lib # for a continuous build
61-
62-
Back in your webstore checkout:
63-
64-
yarn link "@scientist-softserv/webstore-component-library"
65-
66-
and your `webstore` will start using the local component build.
67-
68-
If you are using a local version of the component library, you will need to temporarily delete the line `"@scientist-softserv/webstore-component-library": "VERSION_HERE",` from the `package.json` file in order to see your local changes as opposed to pulling from the github package.
69-
7037
### Environment Variables
71-
Configure the environment variables below in your local and published application to ensure that it works.
38+
The following variables can be found in the `.env` and `.env.local` files.
39+
40+
| Name | Description | Required |
41+
| ------------- | ------------- | ------------- |
42+
| NEXT_PUBLIC_PROVIDER_NAME | The subdomain of the `marketplace-domain` | Yes |
43+
| NEXT_PUBLIC_PROVIDER_ID | TODO | Yes |
44+
| NEXT_PUBLIC_APP_BASE_URL | TODO | Yes |
45+
| NEXT_PUBLIC_SCIENTIST_API_VERSION | TODO | Yes |
46+
| NEXT_PUBLIC_WEBHOOK_URL | TODO | Yes |
47+
| NEXTAUTH_SECRET | TODO | Yes |
48+
| NEXTAUTH_URL | TODO | Yes |
49+
| CLIENT_ID | TODO | Yes |
50+
| CLIENT_SECRET | TODO | Yes |
51+
| NEXT_PUBLIC_TOKEN | TODO | Yes |
52+
| SENTRY_DSN | TODO | No |
53+
| NEXT_PUBLIC_SENTRY_DSN | TODO | No |
54+
| SENTRY_URL | TODO | No |
55+
| SENTRY_ORG | TODO | No |
56+
| SENTRY_PROJECT | TODO | No |
57+
| SENTRY_AUTH_TOKEN | TODO | No |
58+
59+
#### Creating the marketplace app
60+
Ensure that a marketplace, e.g. client-name.scientist.com, has been created by the Scientist.com Professional Services team. Once that exists, an app needs to be created on it by a developer with the proper permissions. This will allow for the environment variables in the `.env` and `.env.local` files to be set. You'll know if you have the proper developer permissions if once logged in on the client marketplace you can hover over your avatar and see "Applications" underneath the "Developer" settings.
61+
- Once you've clicked the "Applications" link mentioned above, press "New Application"
62+
- Only the application name is required for the moment
63+
- Save and you should be redirected to the "Developer Details" page
64+
- There will be a button that says "Reveal Token"
65+
- Click it. You'll need that token in the next step.
66+
67+
#### Provider ID
68+
In an API GUI (e.g. Postman) make a GET request for `<marketplace-domain>/api/v2/providers.json?q=${YOUR_PROVIDER_NAME}`, e.g. `webstore.scientist.com/api/v2/providers.json?q=webstore`. Your authorization needs to be your token from the step above, formatted as a Bearer Token. Scroll to the `provider_refs` array and use the `provider_id` value to fill in the `NEXT_PUBLIC_PROVIDER_ID` variable below.
69+
70+
The `NEXT_PUBLIC_PROVIDER_NAME` needs to exactly match the subdomain of the `marketplace-domain`.
7271

73-
#### Provider
74-
Someone with access to the api needs to visit `/providers.json?q=${YOUR_PROVIDER_NAME}` to find your provider object and id. Once found, update the variable below.
7572

7673
``` bash
7774
# .env
78-
NEXT_PUBLIC_PROVIDER_NAME # e.g.: acme
75+
NEXT_PUBLIC_PROVIDER_NAME # e.g.: webstore
7976
NEXT_PUBLIC_PROVIDER_ID # e.g.: 500
8077
```
8178

@@ -108,6 +105,45 @@ The curl command will return a JSON object that has an `access_token` property.
108105
NEXT_PUBLIC_TOKEN
109106
```
110107

108+
## Webstore Component Library
109+
The webstore requires a [React component library](https://reactjs.org/docs/react-component.html) of view components. That dependency is packaged and released independently.
110+
111+
#### Upgrading To The Latest Version
112+
In the terminal:
113+
``` bash
114+
# first check for whether there is an updated version
115+
yarn outdated @scientist-softserv/webstore-component-library # check the values under "current" and "latest"
116+
117+
# if there's an updated version
118+
yarn upgrade @scientist-softserv/webstore-component-library --latest
119+
```
120+
121+
#### Component Library Dev Mode
122+
Using the local github repository requires you to manually clone the component library to your computer, build, and link it:
123+
124+
Preparing your local copy of the component library:
125+
126+
git clone https://github.com/scientist-softserv/webstore-component-library.git
127+
cd webstore-component-library
128+
npm install
129+
yarn link # now there is a magic symlink in `~/.config/yarn/link` usable by the webstore app
130+
131+
If there are changes to the component library, you will need to rebuild in order to get the newest changes. You can either rebuild manually after changes are made, or have the webstore continually "watch" for changes:
132+
133+
npm run build-lib # for a onetime build
134+
npm run watch-lib # for a continuous build
135+
136+
Back in your webstore checkout:
137+
138+
yarn link "@scientist-softserv/webstore-component-library"
139+
140+
and your `webstore` will start using the local component build.
141+
142+
If you are using a local version of the component library, you will need to temporarily delete the line `"@scientist-softserv/webstore-component-library": "VERSION_HERE",` from the `package.json` file in order to see your local changes as opposed to pulling from the github package.
143+
144+
## Exception Handling
145+
<!-- TODO: add sentry details -->
146+
111147
## Linting
112148
``` bash
113149
# lint all files

0 commit comments

Comments
 (0)