From d41b27f43335cfb1a8ff49aeb121f992332429cf Mon Sep 17 00:00:00 2001 From: HampusM Date: Thu, 12 Aug 2021 15:37:30 +0200 Subject: Cleaned up the settings implementation & renamed base_dir project-wide to git_dir --- packages/server/src/routes/api/v1/index.ts | 4 ++-- packages/server/src/routes/api/v1/repo/index.ts | 2 +- packages/server/src/routes/repo.ts | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'packages/server/src/routes') diff --git a/packages/server/src/routes/api/v1/index.ts b/packages/server/src/routes/api/v1/index.ts index 9c35d53..1adb3cb 100644 --- a/packages/server/src/routes/api/v1/index.ts +++ b/packages/server/src/routes/api/v1/index.ts @@ -21,7 +21,7 @@ function reposEndpoints(fastify: FastifyInstance, opts: FastifyPluginOptions, do method: "GET", url: "/repos", handler: async(req, reply) => { - const repos = await Repository.openAll(opts.config.settings.base_dir); + const repos = await Repository.openAll(opts.config.settings.git_dir); if(!repos) { reply.send({ data: [] }); @@ -49,7 +49,7 @@ function reposEndpoints(fastify: FastifyInstance, opts: FastifyPluginOptions, do return; } - const repository: Repository | BaseError = await Repository.open(opts.config.settings.base_dir, req.params.repo).catch(err => err); + const repository: Repository | BaseError = await Repository.open(opts.config.settings.git_dir, req.params.repo).catch(err => err); if(repository instanceof BaseError) { reply.code(repository.code).send({ error: repository.message }); diff --git a/packages/server/src/routes/api/v1/repo/index.ts b/packages/server/src/routes/api/v1/repo/index.ts index b1b1030..bcd2e5c 100644 --- a/packages/server/src/routes/api/v1/repo/index.ts +++ b/packages/server/src/routes/api/v1/repo/index.ts @@ -19,7 +19,7 @@ declare module "fastify" { function addHooks(fastify: FastifyInstance, opts: FastifyPluginOptions): void { fastify.addHook("preHandler", async(req: CoolFastifyRequest, reply) => { - const repository = await Repository.open(opts.config.settings.base_dir, req.params.repo, req.query.branch).catch((err: BaseError) => err); + const repository = await Repository.open(opts.config.settings.git_dir, req.params.repo, req.query.branch).catch((err: BaseError) => err); if(repository instanceof BaseError) { reply.code(repository.code).send({ error: repository.message }); diff --git a/packages/server/src/routes/repo.ts b/packages/server/src/routes/repo.ts index 99c2295..43d89d2 100644 --- a/packages/server/src/routes/repo.ts +++ b/packages/server/src/routes/repo.ts @@ -35,7 +35,7 @@ export default function(fastify: FastifyInstance, opts: FastifyPluginOptions, do return; } - const repository = await Repository.open(opts.config.settings.base_dir, req.params.repo); + const repository = await Repository.open(opts.config.settings.git_dir, req.params.repo); repository.HTTPconnect(req, reply); } }); @@ -44,7 +44,7 @@ export default function(fastify: FastifyInstance, opts: FastifyPluginOptions, do method: "POST", url: "/git-upload-pack", handler: async(req, reply) => { - const repository = await Repository.open(opts.config.settings.base_dir, req.params.repo); + const repository = await Repository.open(opts.config.settings.git_dir, req.params.repo); repository.HTTPconnect(req, reply); } }); @@ -62,7 +62,7 @@ export default function(fastify: FastifyInstance, opts: FastifyPluginOptions, do method: "GET", url: "/refs/tags/:tag", handler: async(req, reply) => { - const repository = await Repository.open(opts.config.settings.base_dir, req.params.repo).catch((err: BaseError) => err); + const repository = await Repository.open(opts.config.settings.git_dir, req.params.repo).catch((err: BaseError) => err); if(repository instanceof BaseError) { reply.code(repository.code).send(repository.message); -- cgit v1.2.3-18-g5258