Skip to content
Snippets Groups Projects
Commit 116b00cb authored by michael.minelli's avatar michael.minelli
Browse files

Config => Move gitlab URL tu shared

parent cc0b81bf
No related branches found
No related tags found
No related merge requests found
......@@ -24,7 +24,7 @@ class Config {
};
public readonly gitlab: {
apiURL: string; urls: Array<string>; account: { id: number; username: string; token: string; }; group: { root: number; templates: number; assignments: number; exercises: number; }, badges: { pipeline: ConfigGitlabBadge }
urls: Array<string>; account: { id: number; username: string; token: string; }; group: { root: number; templates: number; assignments: number; exercises: number; }, badges: { pipeline: ConfigGitlabBadge }
};
public readonly assignment: {
......@@ -55,7 +55,6 @@ class Config {
};
this.gitlab = {
apiURL : process.env.GITLAB_API_URL || '',
urls : JSON5.parse(process.env.GITLAB_URLS || '[]'),
account: {
id : Number(process.env.GITLAB_DOJO_ACCOUNT_ID || 0),
......
......@@ -11,11 +11,12 @@ import parseLinkHeader from 'parse-link-header';
import GitlabFile from '../shared/types/Gitlab/GitlabFile';
import express from 'express';
import GitlabRoute from '../shared/types/Gitlab/GitlabRoute';
import SharedConfig from '../shared/config/SharedConfig';
class GitlabManager {
private getApiUrl(route: GitlabRoute): string {
return `${ Config.gitlab.apiURL }${ route }`;
return `${ SharedConfig.gitlab.apiURL }${ route }`;
}
public async getUserById(id: number): Promise<GitlabUser | undefined> {
......
......@@ -2,6 +2,7 @@ import axios, { AxiosError, AxiosRequestHeaders } from 'axios';
import Config from '../config/Config';
import FormData from 'form-data';
import logger from '../shared/logging/WinstonLogger';
import SharedConfig from '../shared/config/SharedConfig';
class HttpManager {
......@@ -16,7 +17,7 @@ class HttpManager {
config.headers = { ...config.headers, ...(config.data as FormData).getHeaders() } as AxiosRequestHeaders;
}
if ( config.url && config.url.indexOf(Config.gitlab.apiURL) !== -1 ) {
if ( config.url && config.url.indexOf(SharedConfig.gitlab.apiURL) !== -1 ) {
config.headers['PRIVATE-TOKEN'] = Config.gitlab.account.token;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment