Skip to content

Commit

Permalink
Change the variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
mansab committed Jul 17, 2023
1 parent 565721b commit b636d8b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ it can be provided by **either** of the following methods:
* You will need to set the following environment variables:
```
APP_AUTH_ID=<id_of_your_github_app>
B64_APP_AUTH_PRIVATE_KEY=<private_key_of_your_github_app_bas64_encoded>
APP_AUTH_PRIVATE_KEY_B64=<private_key_of_your_github_app_bas64_encoded>
APP_AUTH_INSTALLATION_ID=<installtion_id_once_installed>
```
* Please refer to Github's offical documentation to know what these values are and where can you find them
Expand Down Expand Up @@ -70,7 +70,7 @@ You can do this in two ways:
```bash
docker run -p 8000:8000 \
-e APP_AUTH_ID="<id_of_your_github_app>" \
-e B64_APP_AUTH_PRIVATE_KEY="<private_key_of_your_github_app_base64_encoded>" \
-e APP_AUTH_PRIVATE_KEY_B64="<private_key_of_your_github_app_base64_encoded>" \
-e APP_AUTH_INSTALLATION_ID="<installtion_id_once_installed>" \
-e BASIC_AUTH_USERNAME="<your_username>" \
-e BASIC_AUTH_PASSWORD="<your_password>" \
Expand Down
2 changes: 1 addition & 1 deletion src/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@

GITHUB_TOKEN = os.environ.get("GITHUB_TOKEN")
APP_AUTH_ID = os.environ.get("APP_AUTH_ID")
B64_APP_AUTH_PRIVATE_KEY = os.environ.get("B64_APP_AUTH_PRIVATE_KEY")
APP_AUTH_PRIVATE_KEY_B64 = os.environ.get("APP_AUTH_PRIVATE_KEY_B64")
APP_AUTH_INSTALLATION_ID = os.environ.get("APP_AUTH_INSTALLATION_ID")
APP_AUTH_BASE_URL = "https://api.github.com"
6 changes: 3 additions & 3 deletions src/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
APP_AUTH_ID,
APP_AUTH_BASE_URL,
APP_AUTH_INSTALLATION_ID,
B64_APP_AUTH_PRIVATE_KEY,
APP_AUTH_PRIVATE_KEY_B64,
)


Expand Down Expand Up @@ -45,15 +45,15 @@ def get_token():
token = GITHUB_TOKEN
elif args.mode == "app-auth":
app_auth_id = APP_AUTH_ID
B64_APP_AUTH_PRIVATE_KEY = decode_base64(B64_APP_AUTH_PRIVATE_KEY)
APP_AUTH_PRIVATE_KEY_B64 = decode_base64(APP_AUTH_PRIVATE_KEY_B64)
app_auth_installation_id = APP_AUTH_INSTALLATION_ID
app_auth_base_url = APP_AUTH_BASE_URL

now = datetime.datetime.utcnow()
iat = int((now - datetime.datetime(1970, 1, 1)).total_seconds())
exp = iat + 600
payload = {"iat": iat, "exp": exp, "iss": app_auth_id}
encoded_jwt = jwt.encode(payload, B64_APP_AUTH_PRIVATE_KEY, algorithm="RS256")
encoded_jwt = jwt.encode(payload, APP_AUTH_PRIVATE_KEY_B64, algorithm="RS256")
headers = {
"Authorization": f"Bearer {encoded_jwt}",
"Accept": "application/vnd.github.v3+json",
Expand Down

0 comments on commit b636d8b

Please sign in to comment.