-
Notifications
You must be signed in to change notification settings - Fork 26
Replaces .env file with env vars in README #170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
ae52d40
02df2ba
65bc4a4
ca456e8
94b098c
7ba4ca2
943ed36
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,8 +46,9 @@ plumbing: packp, Skip argument validations for unknown capabilities. Fixes #623 | |
|
||
## Development | ||
|
||
> Please note: you will need a .env file configured with working GitHub OAuth credentials to run the application in development mode. | ||
> Please follow the [README Installation section](./README.md#installation) for instructions on how to do it. | ||
For convenience, you can configure a file with all the environment variables described in the [README](./README.md). To do so, copy `.env.tpl` to `.env`. | ||
|
||
_Note_: you will need a `.env` file configured with working GitHub OAuth credentials to run the application in development mode. In order to be able to use this application while running the tool locally, make sure you use `http://127.0.0.1:8080/oauth-callback` as the "Authorization callback URL". Please follow the [README Installation section](./README.md#installation) for instructions on how to do it. | ||
|
||
|
||
### Global dependencies | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,23 +20,42 @@ Source code annotation tool offers an UI to annotate source code and review thes | |
|
||
## Installation | ||
|
||
## Github OAuth tokens | ||
## Environment Variables | ||
|
||
|
||
1. You need an OAuth application on GitHub. See [how to create OAuth applications on GitHub](https://developer.github.com/apps/building-oauth-apps/creating-an-oauth-app/). | ||
The next sections make use of several environment variables to configure the application. In this table you will find all of them grouped as a quick reference: | ||
|
||
In order to be able to use this application while running the tool locally, make sure you add http://127.0.0.1:8080/oauth-callback to the authorization callback URL field. | ||
| Variable | Required | Default value | Meaning | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. people often move not mandatory variables somewhere in the bottom of README. Currently, the table is larger than my display and we are going to have more... Just as an idea for improvement. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this I'd reorder the mandatory ones in a way it appears first, but it's up to you @carlosms There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks both for the feedback, I moved the mandatory vars to the top of the table. |
||
| -- | -- | -- | -- | | ||
| `CAT_ENV` | | `production` | Sets the log level. Use `dev` to enable debug log messages | | ||
| `CAT_HOST` | | `0.0.0.0` | IP address to bind the HTTP server | | ||
| `CAT_PORT` | | `8080` | Port address to bind the HTTP server | | ||
| `CAT_SERVER_URL` | | `<CAT_HOST>:<CAT_PORT>` | TODO | | ||
|
||
| `CAT_UI_DOMAIN` | | `<CAT_HOST>:<CAT_PORT>` | TODO | | ||
|
||
| `CAT_DB_CONNECTION` | | `sqlite:///var/code-annotation/internal.db` | Points to the internal application database. Read below for the complete syntax | | ||
|
||
| `CAT_EXPORTS_PATH` | | `./exports` | Folder where the SQLite files will be created when requested from `http://<your-hostname>/export` | | ||
| | | | | | | ||
| `CAT_OAUTH_CLIENT_ID` | YES | - | GitHub application OAuth credentials | | ||
|
||
| `CAT_OAUTH_CLIENT_SECRET` | YES | - | GitHub application OAuth credentials | | ||
|
||
| `CAT_OAUTH_RESTRICT_ACCESS` | | - | Application access control based on GitHub groups or teams | | ||
|
||
| `CAT_OAUTH_RESTRICT_REQUESTER_ACCESS` | | - | User role control based on GitHub groups or teams | | ||
|
||
| | | | | | | ||
| `CAT_JWT_SIGNING_KEY` | YES | - | Key used to sign JWT (JSON Web Tokens) in the server | | ||
|
||
2. Copy `.env.tpl` to `.env`. | ||
## Github OAuth Tokens | ||
|
||
3. Retrieve the values for your application's Client ID and Client Secret from the [GitHub Developer Settings page](https://github.com/settings/developers) and add them to the end of the corresponding lines in .env. | ||
You need an OAuth application on GitHub. See [how to create OAuth applications on GitHub](https://developer.github.com/apps/building-oauth-apps/creating-an-oauth-app/). Make sure the "Authorization callback URL" points to `http://<your-hostname>/oauth-callback`. | ||
|
||
|
||
Retrieve the values for your application's Client ID and Client Secret from the [GitHub Developer Settings page](https://github.com/settings/developers) and set them to the environment variables `CAT_OAUTH_CLIENT_ID` and `CAT_OAUTH_CLIENT_SECRET`. | ||
|
||
### Docker | ||
|
||
docker run --env-file .env --rm -p 8080:8080 srcd/code-annotation | ||
```bash | ||
$ docker run --rm -p 8080:8080 srcd/code-annotation | ||
|
||
``` | ||
|
||
### Non-docker | ||
|
||
Download binary from [releases](https://github.com/src-d/code-annotation/releases) for your platform. | ||
Download the binary from [releases](https://github.com/src-d/code-annotation/releases) for your platform. | ||
|
||
## Importing and Exporting Data | ||
|
||
|
@@ -73,7 +92,7 @@ For a complete reference of the PostgreSQL connection string, see the [documenta | |
|
||
#### Set the Internal Database Connection | ||
|
||
Before starting the application you will need to set the `CAT_DB_CONNECTION` variable in the `.env` file. It should point to the database created with the `import` command. | ||
Before starting the application you will need to set the `CAT_DB_CONNECTION` environment variable. It should point to the database created with the `import` command. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is default variable ok? If not it should be in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess the default is OK... otherwise it should not be the default value. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe it's not. Opening We have 3 options:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @carlosms please address it somehow before merging (maybe just mention in another issue) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I created issue #173 so we don't loose track of this. |
||
|
||
This variable uses the same `DSN` string as the `import` command to point to a SQLite or PosgreSQL database. | ||
|
||
|
@@ -107,13 +126,13 @@ http://<your-hostname>/export | |
|
||
The annotations made by the users will be stored in the **`assignments`** table. | ||
|
||
## Access control | ||
## Access Control | ||
|
||
It is possible to restrict access and choose each user's role by adding their GitHub accounts to a specific [organization](https://help.github.com/articles/collaborating-with-groups-in-organizations/) or [team](https://help.github.com/articles/organizing-members-into-teams/). | ||
|
||
This is optional, if you don't set any restrictions all users with a valid GitHub account will be able to login as a Requester. You may also set a restriction only for Requester users, and leave open access to anyone as Workers. | ||
|
||
To do so, set the following variables in your `.env` file: | ||
To do so, set the following environment variables: | ||
|
||
* `CAT_OAUTH_RESTRICT_ACCESS` | ||
* `CAT_OAUTH_RESTRICT_REQUESTER_ACCESS` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, for me personally this sentence isn't clear.
Maybe we should rephrase like:
The text isn't perfect, just to give you better understanding what I mean. What do you think?