-
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
Conversation
All the env vars are explained in a table. The .env file is still suggested for development in CONTRIBUTING Signed-off-by: Carlos Martín <carlos.martin.sanchez@gmail.com>
README.md
Outdated
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. | ||
|
||
2. Copy `.env.tpl` to `.env`. | ||
Variable | Required | Default value | Meaning |
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.
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.
Fixed
README.md
Outdated
|
||
docker run --env-file .env --rm -p 8080:8080 srcd/code-annotation | ||
```bash | ||
$ docker run --rm -p 8080:8080 srcd/code-annotation |
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.
Here should be example how to set required env variables. At least:
- CAT_OAUTH_CLIENT_ID
- CAT_OAUTH_CLIENT_SECRET
are there any other?
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.
maybe we also need to provide information how to run it with DB.
Currently, it will run the server with empty DB which isn't very usable.
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.
Done. Regarding your second comment, I think the reordering of the steps falls into #67, to be done in a future PR.
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.
Imo, teaching to the user how to provide a db is out of scope for this PR, and should be done by #67
#### 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 comment
The reason will be displayed to describe this comment to others. Learn more.
is default variable ok? If not it should be in docker run
too.
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.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it's not. Opening /var/code-annotation/internal.db
will fail with error: directory doesn't exist.
We have 3 options:
- change defaults
- change documentation
- add
mkdir
in Dockerfile (I prefer this one)
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.
@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 comment
The reason will be displayed to describe this comment to others. Learn more.
I created issue #173 so we don't loose track of this.
Signed-off-by: Carlos Martín <carlos.martin.sanchez@gmail.com>
Signed-off-by: Carlos Martín <carlos.martin.sanchez@gmail.com>
CONTRIBUTING.md
Outdated
|
||
> 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`. |
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:
For convenience, you can configure
.env
file with all the environment variables described in the README.
We provide a template with the configuration suitable for development in.env.tpl
. You can copy it to.env
and set up GitHub OAuth credentials there.
The text isn't perfect, just to give you better understanding what I mean. What do you think?
README.md
Outdated
| `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 | |
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.
todo? should we write a description here?
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.
Yes, let's add the description now.
Can you please tell me the meaning of SERVER_URL, STATIC_PROXY_TARGET after the changes made in #145 ?
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.
SERVER_URL
doesn't change the meaning. It's server url available from outside. Frontend is using it to make http calls.
STATIC_PROXY_TARGET
not sure we should document it. Normally nobody should change it.
And if they do it should be somehow be reflected in create-react-app. It should set HOST & PORT variables. https://github.com/facebook/create-react-app/blob/next/packages/react-scripts/scripts/start.js#L56
#145 isn't merged yet, it's one of the issues we need to resolve there. Maybe we will remove this variable and replace with something else.
README.md
Outdated
## Installation | ||
|
||
## Github OAuth tokens | ||
## Environment Variables |
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.
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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
Since this README.md
is already huge and imho it does not strictly follow our recommendations for README.md
I would not care too much about the length of the table: I'd merge as soon as possible, and improve README.md
when facing issue #67
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 comment
The 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.
Signed-off-by: Carlos Martín <carlos.martin.sanchez@gmail.com>
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.
LGTM, but could you add some links?
README.md
Outdated
| `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 | |
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.
TODO
value could be
hostname:port
where the API is served
README.md
Outdated
| `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 | |
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.
TODO
value could be
hostname:port
where the frontend is served
README.md
Outdated
| `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 | |
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.
I'd add the link:
syntax of the CAT_DB_CONNECTION
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.
LGTM, but I'd add some links
README.md
Outdated
| `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 | |
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.
I'd add a link to #access-control
README.md
Outdated
| `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 | |
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.
I'd add a link to #access-control
README.md
Outdated
| `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 | |
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.
I'd add a link to #github-oauth-tokens
README.md
Outdated
| `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 | |
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.
I'd add a link to #github-oauth-tokens
Signed-off-by: Carlos Martín <carlos.martin.sanchez@gmail.com>
CONTRIBUTING.md
Outdated
|
||
> 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 `.env` file with all the environment variables described in the [README](./README.md). A template with a sample configuration suitable for development is provided in `.env.tpl`. You can copy it to `.env` and set up the variables there. |
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.
For convenience, you can create a ..
CONTRIBUTING.md
Outdated
> Please follow the [README Installation section](./README.md#installation) for instructions on how to do it. | ||
For convenience, you can configure a `.env` file with all the environment variables described in the [README](./README.md). A template with a sample configuration suitable for development is provided in `.env.tpl`. You can copy it to `.env` and set up the variables there. | ||
|
||
_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. |
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.
What do you think about changing
you will need a .env file ... to run the app in dev mode
-> you will need to customize the configuration, either by setting env vars, or though an .env file .... to
to communicate more clearly the optional nature of .env file?
README.md
Outdated
### 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`. |
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.
It's always good to explain a bit of rationale for a need, so what do you think about re-phrasing by adding:
In order for authentication \w Github to work on your environment, you need to set up OAuth application on Github platform
.
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.
LGTM, imo you can merge once you've addressed @bzz suggestions
Signed-off-by: Carlos Martín <carlos.martin.sanchez@gmail.com>
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.
Many thanks Carlos
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.
Awesome 📜 !
README.md
Outdated
| `CAT_DB_CONNECTION` | | `sqlite:///var/code-annotation/internal.db` | Points to the internal application database. [Read below](#importing-and-exporting-data) for the complete syntax | | ||
| `CAT_EXPORTS_PATH` | | `./exports` | Folder where the SQLite files will be created when requested from `http://<your-hostname>/export` | | ||
| `CAT_ENV` | | `production` | Sets the log level. Use `dev` to enable debug log messages | | ||
| `CAT_STATIC_PROXY_TARGET` | | - | :exclamation: TODO: to be reviewed when [#145](https://github.com/src-d/code-annotation/pull/145) is closed | |
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.
please remove it. #145 may never be merged in master or this variable will be replaced by something
@carlosms Let's remove |
Signed-off-by: Carlos Martín <carlos.martin.sanchez@gmail.com>
Fixes #120
All the env vars are explained in a table. The .env file is still suggested for development in CONTRIBUTING.
The TODOs in the table need to be with the new vars from #145.