Skip to content

Commit f973a23

Browse files
committed
update readme
1 parent 68b6858 commit f973a23

File tree

1 file changed

+46
-15
lines changed

1 file changed

+46
-15
lines changed

README.md

Lines changed: 46 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,40 @@ You can use the App to configure [CCTray Clients](https://cctray.org/clients/):
1616

1717
## Prerequisites
1818

19-
* Github Personal Access Token
20-
* [FGPAT (recommended) or PAT](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)
21-
* Read-Only access to Actions (Workflows, workflow runs and artifacts) required for Private repos.
22-
* Please take into account the [Github API rate limit](https://docs.github.com/en/rest/overview/resources-in-the-rest-api?apiVersion=2022-11-28#rate-limiting) for authentication tokens.
23-
* Development
24-
* Python 3.9
25-
* pip
19+
### Authentication Token
20+
21+
To authenticate with Github API, the app needs a `token`, it can be provided by **either** of the following methods
22+
#### Github Personal Access Token
23+
* [FGPAT (recommended) or PAT](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)
24+
* Read-Only access to Actions (Workflows, workflow runs and artifacts) required for Private repos.
25+
* You will need to set: `GITHUB_TOKEN="<your_token>"` as the environment variable.
26+
27+
#### Github APP (Recommened)
28+
* [Create a Github APP](https://docs.github.com/en/apps/creating-github-apps/registering-a-github-app/registering-a-github-app) and grant Read-Only access to Github Actions
29+
* The Github APP should be installed on the Github Organization or Account with access to the required repositories.
30+
* You will need to set the following environment variable:
31+
```
32+
APP_AUTH_ID=<id_of_your_github_app>
33+
APP_AUTH_PRIVATE_KEY=<private_key_of_your_github_app>
34+
APP_AUTH_INSTALLATION_ID=<installtion_id_once_installed>
35+
```
36+
* Please refer to Github's offical documentation to know what these values are and where can you find them
37+
38+
**Please take into account the [Github API rate limit](https://docs.github.com/en/rest/overview/resources-in-the-rest-api?apiVersion=2022-11-28#rate-limiting) for authentication tokens.**
2639

2740
## With Docker
2841

29-
* Build the Docker image
42+
### Build the Docker image
3043

3144
```bash
3245
docker build -t github-cctray:latest .
3346
```
3447

35-
* Launch the Docker container
48+
### Launch the Docker container
49+
50+
You can do this in two ways:
51+
52+
* Personal Access Token method
3653

3754
```bash
3855
docker run -p 8000:8000 \
@@ -42,6 +59,18 @@ docker build -t github-cctray:latest .
4259
github-cctray:latest
4360
```
4461

62+
* Github App method
63+
64+
```bash
65+
docker run -p 8000:8000 \
66+
-e APP_AUTH_ID="<id_of_your_github_app>" \
67+
-e APP_AUTH_PRIVATE_KEY="<private_key_of_your_github_app>" \
68+
-e APP_AUTH_INSTALLATION_ID="<installtion_id_once_installed>" \
69+
-e BASIC_AUTH_USERNAME="<your_username>" \
70+
-e BASIC_AUTH_PASSWORD="<your_password>" \
71+
github-cctray:latest
72+
```
73+
4574
# Usage
4675

4776
Once up, the App binds to port `8000` by default and should be available at: http://localhost:8000
@@ -57,7 +86,7 @@ The App accepts GET requests with following parameters:
5786

5887
**optional parameter**
5988

60-
* `token` - If you want to use FGPAT per user to access the API, to overcome Github API rate limiting (this takes precedence over the token set in the env var).
89+
* `token` - If you want to use FGPAT per user to access the API, to overcome Github API rate limiting (this takes precedence over the token/Github App auth set in the env var).
6190

6291
For Example:
6392

@@ -158,7 +187,9 @@ curl -X GET http://localhost:8000/limit?token=<your_token>
158187
```
159188

160189
# Development Setup
161-
190+
191+
* Python 3.9
192+
* pip
162193
* Activate [Python virtualenv](https://python.land/virtual-environments/virtualenv)
163194

164195
```bash
@@ -175,10 +206,10 @@ pip install -r requirements.txt
175206
* Execute
176207

177208
```bash
178-
export GITHUB_TOKEN=<token>
179-
export BASIC_AUTH_USERNAME=<user>
180-
export BASIC_AUTH_PASSWORD=<pass>
181-
python app.py
209+
* set necessary env variable to authenticate with Github (see Prerequisites)
210+
* export BASIC_AUTH_USERNAME=<user>
211+
* export BASIC_AUTH_PASSWORD=<pass>
212+
* python app.py
182213
```
183214

184215
# Configuring a Client

0 commit comments

Comments
 (0)