add opengraph images and user profile route0e3d29da month ago63 lines · 2.3 KB | 1 | import { Module } from '@nestjs/common'; |
| 2 | import { ConfigModule, ConfigService |
| 3 | import type { Database |
| 4 | import { AuthModule } |
| 5 | |
| 6 | import { AppController } |
| 7 | import { AppService } |
| 8 | import { DATABASE, DatabaseModule |
| 9 | import { createAuth } |
| 10 | import { IssuesModule } |
| 11 | import { PullRequestsModule } |
| 12 | import { RepositoriesModule } |
| 13 | import { UsersService } |
| 14 | import { GitModule } |
| 15 | import { S3Service } |
| 16 | import { WalService } |
| 17 | import { BranchesService } |
| 18 | import { RepositoryAccessService } |
| 19 | import { UserModule } |
| 20 | |
| 21 | @Module({ |
| 22 | imports: [ |
| 23 | ConfigModule.forRoot({ |
| 24 | isGlobal: true, |
| 25 | // `.env` interpolates values (e.g. BETTER_AUTH_URL=http://localhost:${API_PORT}), |
| 26 | // which dotenv does not expand on its own. |
| 27 | expandVariables: true, |
| 28 | envFilePath: ['.env.local', |
| 29 | }), |
| 30 | DatabaseModule, |
| 31 | AuthModule.forRootAsync({ |
| 32 | imports: [DatabaseModule], |
| 33 | inject: [DATABASE, |
| 34 | useFactory: (db: |
| 35 | auth: createAuth(db |
| 36 | secret: config.getOrThrow |
| 37 | baseURL: config.getOrThrow |
| 38 | trustedOrigins: config |
| 39 | .get<string>( |
| 40 | .split(',') |
| 41 | .map((origin) |
| 42 | .filter(Boolean), |
| 43 | cookieDomain: config.get |
| 44 | }), |
| 45 | }), |
| 46 | }), |
| 47 | RepositoriesModule, |
| 48 | PullRequestsModule, |
| 49 | IssuesModule, |
| 50 | GitModule, |
| 51 | UserModule, |
| 52 | ], |
| 53 | controllers: [AppController], |
| 54 | providers: [ |
| 55 | AppService, |
| 56 | UsersService, |
| 57 | S3Service, |
| 58 | WalService, |
| 59 | BranchesService, |
| 60 | RepositoryAccessService, |
| 61 | ], |
| 62 | }) |
| 63 | export class AppModule |
}
from
'
@nestjs/config
'
;
}
from
'
@ghost/db
'
;
from
'
@thallesp/nestjs-better-auth
'
;
from
'
./app.controller.js
'
;
from
'
./app.service.js
'
;
}
from
'
./database/database.module.js
'
;
from
'
./lib/auth.js
'
;
from
'
./resources/issues/issues.module.js
'
;
from
'
./resources/pull-requests/pull-requests.module.js
'
;
from
'
./resources/repositories/repositories.module.js
'
;
from
'
./services/users/users.service.js
'
;
from
'
./git/git.module.js
'
;
from
'
./services/s3/s3.service.js
'
;
from
'
./services/git/wal/wal.service.js
'
;
from
'
./services/git/branches/branches.service.js
'
;
from
'
./services/git/repository-access/repository-access.service.js
'
;
from
'
./resources/user/user.module.js
'
;
'
.env
'
,
'
../../.env
'
]
,
ConfigService
]
,
Database
,
config
:
ConfigService
)
=>
(
{
,
{
<
string
>
(
'
BETTER_AUTH_SECRET
'
)
,
<
string
>
(
'
BETTER_AUTH_URL
'
)
,
'
AUTH_TRUSTED_ORIGINS
'
,
'
http://localhost:3000
'
)
=>
origin
.
trim
())
<
string
>
(
'
AUTH_COOKIE_DOMAIN
'
)
,
{}