Skip to content

Commit

Permalink
chore: re-instate default repository loading
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieSlome committed Feb 9, 2024
1 parent 0c7004f commit 9f81370
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/proxy/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const proxyApp = require('express')();
const bodyParser = require('body-parser');
const router = require('./routes').router;
const config = require('../config');
const db = require('../db');
const { GIT_PROXY_SERVER_PORT: proxyHttpPort } = require('../config/env').Vars;

const options = {
Expand All @@ -14,6 +16,19 @@ proxyApp.use(bodyParser.raw(options));
proxyApp.use('/', router);

const start = async () => {
// Check to see if the default repos are in the repo list
const defaultAuthorisedRepoList = config.getAuthorisedList();
const allowedList = await db.getRepos();

defaultAuthorisedRepoList.forEach(async (x) => {
const found = allowedList.find((y) => y.project == x.project && x.name == y.name);
if (!found) {
await db.createRepo(x);
await db.addUserCanPush('git-proxy', 'admin');
await db.addUserCanAuthorise('git-proxy', 'admin');
}
});

proxyApp.listen(proxyHttpPort, () => {
console.log(`Proxy Listening on ${proxyHttpPort}`);
});
Expand Down

0 comments on commit 9f81370

Please sign in to comment.