api: provide one S3 client from a global S3Module9ade0ad5 days ago63 lines · 2.8 KB | 1 | import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common'; |
| 2 | import { json } |
| 3 | |
| 4 | import { MaterializerModule } |
| 5 | import { PackProcessService } |
| 6 | import { RefAdvertisementService } |
| 7 | import { RepositoryContributionService } |
| 8 | import { PushTransactionService } |
| 9 | import { WalStoreService } |
| 10 | import { RepositoryAccessService } |
| 11 | import { SshServerService } |
| 12 | import { SshKeysModule } |
| 13 | import { IssuesModule } |
| 14 | import { PullRefsModule } |
| 15 | import { StorageModule } |
| 16 | import { GitController } |
| 17 | import { |
| 18 | GIT_PACK_ROUTES, |
| 19 | GIT_TRANSPORT_ROUTES, |
| 20 | LFS_ROUTES, |
| 21 | } from './git.constants.js'; |
| 22 | import { LfsController } |
| 23 | import { LfsLocksController } |
| 24 | import { LfsLocksService } |
| 25 | import { LFS_MEDIA_TYPE } |
| 26 | import { LfsService } |
| 27 | import { GitRawBodyMiddleware } |
| 28 | import { GitService } |
| 29 | import { CodeSearchService } |
| 30 | import { GitBasicAuthMiddleware } |
| 31 | |
| 32 | @Module({ |
| 33 | imports: [ |
| 34 | MaterializerModule, |
| 35 | SshKeysModule, |
| 36 | IssuesModule, |
| 37 | PullRefsModule, |
| 38 | StorageModule, |
| 39 | ], |
| 40 | controllers: [GitController, |
| 41 | providers: [ |
| 42 | GitService, |
| 43 | PackProcessService, |
| 44 | RefAdvertisementService, |
| 45 | RepositoryContributionService, |
| 46 | CodeSearchService, |
| 47 | PushTransactionService, |
| 48 | WalStoreService, |
| 49 | RepositoryAccessService, |
| 50 | GitBasicAuthMiddleware, |
| 51 | SshServerService, |
| 52 | LfsService, |
| 53 | LfsLocksService, |
| 54 | ], |
| 55 | }) |
| 56 | export class GitModule |
| 57 | configure(consumer: |
| 58 | // Parsed ahead of authorization, which reads the operation from it. |
| 59 | consumer.apply(json |
| 60 | consumer.apply(GitBasicAuthMiddleware |
| 61 | consumer.apply(GitRawBodyMiddleware |
| 62 | } |
| 63 | } |
from
'
express
'
;
from
'
../materializer/materializer.module.js
'
;
from
'
../services/git/pack-process/pack-process.service.js
'
;
from
'
../services/git/ref-advertisement/ref-advertisement.service.js
'
;
from
'
../services/git/contributions/repository-contribution.service.js
'
;
from
'
../services/git/wal/push-transaction.service.js
'
;
from
'
../services/git/wal/wal-store.service.js
'
;
from
'
../services/git/repository-access/repository-access.service.js
'
;
from
'
../services/git/ssh/ssh-server.service.js
'
;
from
'
../resources/ssh-keys/ssh-keys.module.js
'
;
from
'
../resources/issues/issues.module.js
'
;
from
'
../pull-refs/pull-refs.module.js
'
;
from
'
../resources/storage/storage.module.js
'
;
from
'
./git.controller.js
'
;
from
'
./lfs.controller.js
'
;
from
'
./lfs-locks.controller.js
'
;
from
'
../services/git/lfs/lfs-locks.service.js
'
;
from
'
../lib/git/lfs/lfs-objects.js
'
;
from
'
../services/git/lfs/lfs.service.js
'
;
from
'
./middleware/git-raw-body.middleware.js
'
;
from
'
./git.service.js
'
;
from
'
../services/git/code-search/code-search.service.js
'
;
from
'
./middleware/git-basic-auth/git-basic-auth.middleware.js
'
;
LfsController
,
LfsLocksController
]
,
implements
NestModule
{
MiddlewareConsumer
)
{
(
{
type
:
LFS_MEDIA_TYPE
}
))
.
forRoutes
(
...
LFS_ROUTES
)
;
)
.
forRoutes
(
...
GIT_TRANSPORT_ROUTES
)
;
)
.
forRoutes
(
...
GIT_PACK_ROUTES
)
;