feat(gh-85): take git tokens from environment (#88)

This commit is contained in:
Andrea Lamparelli 2023-12-10 22:05:53 +01:00 committed by GitHub
parent aac73bf7c5
commit 70da575afc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 456 additions and 24 deletions

View file

@ -11,16 +11,22 @@ export default class GitHubClient implements GitClient {
private logger: LoggerService;
private apiUrl: string;
private isForCodeberg: boolean;
private octokit: Octokit;
private mapper: GitHubMapper;
constructor(token: string | undefined, apiUrl: string) {
constructor(token: string | undefined, apiUrl: string, isForCodeberg = false) {
this.apiUrl = apiUrl;
this.isForCodeberg = isForCodeberg;
this.logger = LoggerServiceFactory.getLogger();
this.octokit = OctokitFactory.getOctokit(token, this.apiUrl);
this.mapper = new GitHubMapper();
}
getClientType(): GitClientType {
return this.isForCodeberg ? GitClientType.CODEBERG : GitClientType.GITHUB;
}
// READ
getDefaultGitUser(): string {