Skip to content

Commit

Permalink
chore: merge branch 'main' into feat/fix-config
Browse files Browse the repository at this point in the history
  • Loading branch information
mgiancola9 committed Nov 12, 2024
2 parents b93129c + 1e35b93 commit df23dab
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 10 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "@finos/git-proxy",
"version": "1.5.0",
"version": "1.5.1",
"description": "Deploy custom push protections and policies on top of Git.",
"scripts": {
"cli": "node ./packages/git-proxy-cli/index.js",
"client": "vite --config vite.config.js",
"clientinstall": "npm install --prefix client",
"server": "node index.js",
"start": "concurrently 'npm run server' 'npm run client'",
"start": "concurrently \"npm run server\" \"npm run client\"",
"build": "vite build",
"test": "NODE_ENV=test mocha --exit",
"test-coverage": "nyc npm run test",
Expand Down
7 changes: 4 additions & 3 deletions src/proxy/processors/push-action/blockForAuth.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
const Step = require('../../actions').Step;
const { getServiceUIURL } = require('../../../service/urls');

const { GIT_PROXY_UI_PORT: uiPort } = require('../../../config/env').Vars;
const Step = require('../../actions').Step;

const exec = async (req, action) => {
const step = new Step('authBlock');
const url = getServiceUIURL(req);

const message =
'\n\n\n' +
`\x1B[32mGitProxy has received your push ✅\x1B[0m\n\n` +
'🔗 Shareable Link\n\n' +
`\x1B[34mhttp://localhost:${uiPort}/admin/push/${action.id}\x1B[0m` +
`\x1B[34m${url}/admin/push/${action.id}\x1B[0m` +
'\n\n\n';
step.setAsyncBlock(message);

Expand Down
2 changes: 1 addition & 1 deletion src/proxy/processors/push-action/pullRemote.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const exec = async (req, action) => {
}

if (!fs.existsSync(action.proxyGitPath)) {
fs.mkdirSync(action.proxyGitPath, '0777', true);
fs.mkdirSync(action.proxyGitPath, '0755', true);
}

const cmd = `git clone ${action.url} --bare`;
Expand Down
2 changes: 1 addition & 1 deletion src/service/routes/repo.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const express = require('express');
const router = new express.Router();
const db = require('../../db');
const { getProxyURL } = require('../proxyURL');
const { getProxyURL } = require('../urls');

router.get('/', async (req, res) => {
const proxyURL = getProxyURL(req);
Expand Down
7 changes: 7 additions & 0 deletions src/service/proxyURL.js → src/service/urls.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,11 @@ module.exports = {
);
return config.getDomains().proxy ?? defaultURL;
},
getServiceUIURL: (req) => {
const defaultURL = `${req.protocol}://${req.headers.host}`.replace(
`:${PROXY_HTTP_PORT}`,
`:${UI_PORT}`,
);
return config.getDomains().service ?? defaultURL;
},
};
2 changes: 1 addition & 1 deletion test/proxyURL.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const chai = require('chai');
const sinon = require('sinon');
const express = require('express');
const chaiHttp = require('chai-http');
const { getProxyURL } = require('../src/service/proxyURL');
const { getProxyURL } = require('../src/service/urls');
const config = require('../src/config');

chai.use(chaiHttp);
Expand Down

0 comments on commit df23dab

Please sign in to comment.