Skip to content
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

Update GithubApi constructor to include baseUrl parameter and set de… #611

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions server/src/git/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@ import { RequestError } from '@octokit/types';
export class GithubApi extends Repo {
private octokit: any;

constructor(token: string) {
constructor(baseUrl: string, token: string) {
super("github");

if (baseUrl === '') {
baseUrl = 'https://api.github.com';
}

this.octokit = new Octokit({
auth: token
auth: token,
baseUrl: baseUrl,
});
}

Expand Down
2 changes: 1 addition & 1 deletion server/src/git/repo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { GiteaApi } from './gitea';

describe('GithubApi', () => {
it('should load config', () => {
const github = new GithubApi("token");
const github = new GithubApi('', "token");
expect(github).toBeTruthy();
});
});
Expand Down
2 changes: 1 addition & 1 deletion server/src/kubero.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class Kubero {

this.giteaApi = new GiteaApi(process.env.GITEA_BASEURL as string, process.env.GITEA_PERSONAL_ACCESS_TOKEN as string);
this.gogsApi = new GogsApi(process.env.GOGS_BASEURL as string, process.env.GOGS_PERSONAL_ACCESS_TOKEN as string);
this.githubApi = new GithubApi(process.env.GITHUB_PERSONAL_ACCESS_TOKEN as string);
this.githubApi = new GithubApi(process.env.GITHUB_BASEURL as string, process.env.GITHUB_PERSONAL_ACCESS_TOKEN as string);
this.gitlabApi = new GitlabApi(process.env.GITLAB_BASEURL as string, process.env.GITLAB_PERSONAL_ACCESS_TOKEN as string);
this.bitbucketApi = new BitbucketApi(process.env.BITBUCKET_USERNAME as string, process.env.BITBUCKET_APP_PASSWORD as string);

Expand Down
2 changes: 1 addition & 1 deletion server/src/modules/repositories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class Repositories {
constructor() {
this.giteaApi = new GiteaApi(process.env.GITEA_BASEURL as string, process.env.GITEA_PERSONAL_ACCESS_TOKEN as string);
this.gogsApi = new GogsApi(process.env.GOGS_BASEURL as string, process.env.GOGS_PERSONAL_ACCESS_TOKEN as string);
this.githubApi = new GithubApi(process.env.GITHUB_PERSONAL_ACCESS_TOKEN as string);
this.githubApi = new GithubApi(process.env.GITHUB_BASEURL as string, process.env.GITHUB_PERSONAL_ACCESS_TOKEN as string);
this.gitlabApi = new GitlabApi(process.env.GITLAB_BASEURL as string, process.env.GITLAB_PERSONAL_ACCESS_TOKEN as string);
this.bitbucketApi = new BitbucketApi(process.env.BITBUCKET_USERNAME as string, process.env.BITBUCKET_APP_PASSWORD as string);
}
Expand Down