|
1 | 1 | # bolt
|
| 2 | + |
2 | 3 | Simple and efficient hardware checkout system
|
3 | 4 |
|
4 | 5 | # Server setup
|
5 |
| -Required items: |
6 | 6 |
|
7 |
| - - A postrgesql server and database |
8 |
| - - Install dependencies: `npm install` |
9 |
| - - **NOTE:** For server deployments, the `postinstall` NPM script, which will also run when you run `npm install`, will |
10 |
| - try to run the Knex (database abstraction layer) migrations. Since you probably haven't added your database configuration, |
11 |
| - this step will fail. Just ignore the error for now and follow the steps after this to properly run the migrations. |
12 |
| - - Configure the required environment variables in `configs/config.json`. You can copy and rename `configs/configs.json.example`. |
13 |
| - - Re-run the database migrations using `npm run knex:migrate:latest`. |
| 7 | +Required items: |
14 | 8 |
|
15 |
| -By default, DB migrations will run automatically if you run `npm start`. To avoid this, you can start the server using `npm run dev` or `npm run start:no-migration` and database migrations will *not* run before you start the server. |
| 9 | +- A postrgesql server and database |
| 10 | +- Install dependencies: `yarn install` |
| 11 | +- Configure the required environment variables in `configs/config.json`. You can copy and rename `configs/configs.json.example`. |
| 12 | +- Run the database migrations using `yarn migrate:dev`. |
| 13 | +- Start the server for development with `yarn dev` |
16 | 14 |
|
17 | 15 | # Client setup
|
18 | 16 |
|
19 | 17 | Note: the hardware desk page (/admin/desk) relies on a WebSocket connection to the server. The client assumes that you are
|
20 |
| -running the server on port 3000. If this isn't right, then you'll need to update the port in |
| 18 | +running the server on port 3000. If this isn't right, then you'll need to update the port in |
21 | 19 |
|
22 | 20 | 1. The `proxy` property in the **client's** package.json file
|
23 | 21 | 2. The local development WebSocket URL in `client/index.tsx`
|
24 | 22 | 3. `baseUrl` in `client/src/components/admin/AdminOverviewContainer.tsx`
|
25 | 23 |
|
26 |
| -to use the correct server port. Make sure you don't commit the files with the changed port! |
27 |
| - |
28 |
| -Required environment variables |
29 |
| ------ |
| 24 | +to use the correct server port. Make sure you don't commit the files with the changed port! |
| 25 | + |
| 26 | +## Required environment variables |
30 | 27 |
|
31 | 28 | ### Backend
|
32 |
| -| Variable | Description | |
33 |
| -|----|----| |
34 |
| -| secrets.adminKey | Random string of letters and numbers |
35 |
| -| secrets.session | Random string of letters and numbers used to secure sessions |
36 |
| -| secrets.groundTruth.url | URL to [Ground Truth](https://github.com/hackgt/ground-truth) authentication service |
37 |
| -| secrets.groundTruth.id | Client ID provided by Ground Truth |
38 |
| -| secrets.groundTruth.secret | Client secret provided by Ground Truth |
39 |
| -| secrets.admins.domains | Email domains that will result in a user being automatically made an admin |
40 |
| -| secrets.admins.emails | Email address that will result in a user being automatically made an admin |
41 |
| -| secrets.server.postgresURL | URL to connect to the postgresql database. If you need to supply database connection credentials, this is the place to do it. |
42 |
| -| secrets.server.isProduction | Boolean indicating whether to run the server in production mode. |
43 |
| -| secrets.server.defaultTimezone | Default server timezone |
| 29 | + |
| 30 | +| Variable | Description | |
| 31 | +| ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------- | |
| 32 | +| secrets.adminKey | Random string of letters and numbers | |
| 33 | +| secrets.session | Random string of letters and numbers used to secure sessions | |
| 34 | +| secrets.groundTruth.url | URL to [Ground Truth](https://github.com/hackgt/ground-truth) authentication service | |
| 35 | +| secrets.groundTruth.id | Client ID provided by Ground Truth | |
| 36 | +| secrets.groundTruth.secret | Client secret provided by Ground Truth | |
| 37 | +| secrets.admins.domains | Email domains that will result in a user being automatically made an admin | |
| 38 | +| secrets.admins.emails | Email address that will result in a user being automatically made an admin | |
| 39 | +| secrets.server.postgresURL | URL to connect to the postgresql database. If you need to supply database connection credentials, this is the place to do it. | |
| 40 | +| secrets.server.isProduction | Boolean indicating whether to run the server in production mode. | |
| 41 | +| secrets.server.defaultTimezone | Default server timezone | |
44 | 42 |
|
45 | 43 | ### Frontend
|
46 |
| -In /client, .env contains defaults for required variables. Create .env.local to override these environment |
| 44 | + |
| 45 | +In /client, .env contains defaults for required variables. Create .env.local to override these environment |
47 | 46 | variables, or define them as temporary environment variables in your shell.
|
48 | 47 |
|
49 |
| -| Variable | Description | |
50 |
| -|----|----| |
51 |
| -| REACT_APP_ENABLE_BUGSNAG | "true" or "false" whether to enable the Bugsnag integration. Keep disabled for local development unless testing Bugsnag-specific features |
52 |
| -| REACT_APP_BUGSNAG_API_KEY | Required if REACT_APP_ENABLE_BUGSNAG is enabled. Value should be the Notifier API Key for the Bugsnag project |
| 48 | +| Variable | Description | |
| 49 | +| ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | |
| 50 | +| REACT_APP_ENABLE_BUGSNAG | "true" or "false" whether to enable the Bugsnag integration. Keep disabled for local development unless testing Bugsnag-specific features | |
| 51 | +| REACT_APP_BUGSNAG_API_KEY | Required if REACT_APP_ENABLE_BUGSNAG is enabled. Value should be the Notifier API Key for the Bugsnag project | |
| 52 | + |
| 53 | +# Development |
53 | 54 |
|
54 |
| -Development |
55 |
| -==== |
56 | 55 | - For local development:
|
57 | 56 | - Access server endpoints, such as authentication, using the development server.
|
58 |
| - - For frontend development, run `npm start` inside the `/client` directory. |
59 |
| -- You can find GraphiQL at `/api/graphiql`, but note that this endpoint is restricted to admin users. For local development, |
60 |
| -promote your account to an admin in order to access GraphiQL. |
61 |
| - |
62 |
| -Code Style |
63 |
| ----- |
64 |
| -Code style is enforced by tslint. The project standard is 4-space indentation; please ensure that any files you change |
65 |
| -comply with this. |
66 |
| - |
67 |
| -If you use an editor like IntelliJ, you can automatically apply most of the code style specifications found in `tslint.json`. |
68 |
| - |
69 |
| -Database |
70 |
| ----- |
71 |
| -**Note** - If you add an item to the database manually (e.g., by manually executing SQL queries in Postgres), |
72 |
| -knex (our DB query builder) will not know about this and you'll get errors on any table that has an auto-incrementing |
73 |
| -primary key. Solution: keep running your query (if the IDs are still a low number) and eventually knex will catch up, or |
74 |
| -only insert rows into these tables through existing Bolt APIs (e.g., create items using the GraphQL API or web UI). |
75 |
| -Source: https://github.com/tgriesser/knex/issues/1855#issuecomment-416076299 |
| 57 | + - For frontend development, run `yarn start` inside the `/client` directory. |
| 58 | +- You can find GraphiQL at `/api/graphiql`, but note that this endpoint is restricted to admin users. For local development, |
| 59 | + promote your account to an admin in order to access GraphiQL. |
| 60 | + |
| 61 | +## Code Style |
| 62 | + |
| 63 | +Code style is enforced by eslint, prettier, and stylelint via config. |
0 commit comments