1
0
Fork 0
mirror of https://code.forgejo.org/actions/git-backporting synced 2025-07-01 23:06:00 +02:00

feat: config file as option (#42)

Fix https://github.com/lampajr/backporting/issues/37

This enhancement required a huge refactoring where all arguments
defaults have been centralized in one single place ArgsParser#parse
This commit is contained in:
Andrea Lamparelli 2023-07-05 22:11:23 +02:00 committed by GitHub
parent a88adeec35
commit 5ead31f606
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 1465 additions and 219 deletions

View file

@ -14,13 +14,13 @@ export default class GitLabClient implements GitClient {
private readonly mapper: GitLabMapper;
private readonly client: Axios;
constructor(token: string, apiUrl: string, rejectUnauthorized = false) {
constructor(token: string | undefined, apiUrl: string, rejectUnauthorized = false) {
this.logger = LoggerServiceFactory.getLogger();
this.apiUrl = apiUrl;
this.client = axios.create({
baseURL: this.apiUrl,
headers: {
Authorization: `Bearer ${token}`,
Authorization: token ? `Bearer ${token}` : "",
"User-Agent": "lampajr/backporting",
},
httpsAgent: new https.Agent({
@ -30,6 +30,14 @@ export default class GitLabClient implements GitClient {
this.mapper = new GitLabMapper(this.client);
}
getDefaultGitUser(): string {
return "Gitlab";
}
getDefaultGitEmail(): string {
return "noreply@gitlab.com";
}
// READ
// example: <host>/api/v4/projects/alampare%2Fbackporting-example/merge_requests/1