Skip to content

Commit

Permalink
more small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiago Posse committed Sep 28, 2023
1 parent c2c8556 commit 7bb84f9
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/gitlab/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ async function resolveGitlabApiToken(): Promise<string> {
if (!fs.existsSync(process.env.GITLAB_API_TOKEN_FILE)) {
throw Error(`Gitlab API token file does not exist: ${process.env.GITLAB_API_TOKEN_FILE}`)
}
return (fs.readFileSync(process.env.GITLAB_API_TOKEN_FILE)).toString()
return (fs.readFileSync(process.env.GITLAB_API_TOKEN_FILE)).toString().trim()
}

if (process.env.GITLAB_API_TOKEN !== undefined) {
Expand Down
13 changes: 0 additions & 13 deletions src/gitlab/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { logger } from "../utils/logging"
import fetch, {
Headers,
Request,
RequestInit,
Response,
Expand Down Expand Up @@ -41,17 +39,6 @@ export abstract class Gitlab {
}

config.headers = { ...this.headers, ...config.headers }
// if (config.body !== undefined) {
// if ((config.headers as Headers).get("Content-Type") === "application/x-www-form-urlencoded") {
// let formBody = []
// for (const k of Object.keys(config.body)) {
// formBody.push(`${k}=${config.body[k]}`)
// }
// config.body = formBody.join("&")
// } else {
// config.body = JSON.stringify(config.body)
// }
// }

const req = new Request(`${this.url}${url}`, config)
const resp = await fetch(req)
Expand Down
2 changes: 1 addition & 1 deletion src/gitlab/scim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ async function resolveGitlabScimToken(): Promise<string> {
if (!fs.existsSync(process.env.GITLAB_SCIM_TOKEN_FILE)) {
throw Error(`Gitlab SCIM token file does not exist: ${process.env.GITLAB_SCIM_TOKEN_FILE}`)
}
return (fs.readFileSync(process.env.GITLAB_SCIM_TOKEN_FILE)).toString()
return (fs.readFileSync(process.env.GITLAB_SCIM_TOKEN_FILE)).toString().trim()
}

if (process.env.GITLAB_SCIM_TOKEN !== undefined) {
Expand Down
1 change: 0 additions & 1 deletion src/google/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { GoogleUser, GoogleGroupMember, GoogleGroupsListResponse, GoogleUsersLis
import { minimatch } from 'minimatch';
import { getSecretFromAws } from "../utils/aws";
import fs from 'fs';
import { logger } from '../utils/logging';

const SCOPES = [
'https://www.googleapis.com/auth/admin.directory.user.readonly',
Expand Down

0 comments on commit 7bb84f9

Please sign in to comment.