Skip to content

Commit

Permalink
Support reading GitHub token from env var
Browse files Browse the repository at this point in the history
I would like to share my config.yaml and update scripts in a git repo, so I need a way to supply the GitHub token outside of config.yaml

This solution felt natural to me, but I would be willing to take a second pass utilizing a credentials file instead.

Thanks for this great tool!
  • Loading branch information
tplass-ias committed Jan 14, 2025
1 parent 3cc3170 commit 7e4b1fd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ update_command:
- my-file
```
If you wish to keep your API Key outside of `config.yaml`, set the env var `APR_API_KEY` with your GitHub Token

### Repositories

You can define the list of repositories to pull and build into the database to update using a list of rules.
Expand Down
3 changes: 2 additions & 1 deletion autopr/config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from dataclasses import dataclass, field
from typing import List, Optional
from os import environ

import marshmallow_dataclass

Expand All @@ -17,8 +18,8 @@

@dataclass
class Credentials:
api_key: str
ssh_key_file: str
api_key: str = environ.get("APR_API_KEY", "")


CREDENTIALS_SCHEMA = marshmallow_dataclass.class_schema(Credentials)()
Expand Down

0 comments on commit 7e4b1fd

Please sign in to comment.