diff --git a/backend/src/app.module.ts b/backend/src/app.module.ts index d2cac46..ecdb652 100644 --- a/backend/src/app.module.ts +++ b/backend/src/app.module.ts @@ -6,7 +6,6 @@ import { LoggerModule } from "nestjs-pino"; import { AuthModule } from "./auth/auth.module"; import { BuilderModule } from "./builder/builder.module"; import appConfig from "./config/app.config"; -import { IS_PROD } from "./constants"; import { dataSourceOptions } from "./data.source"; import { MetricsModule } from "./metrics/metrics.module"; import { MiscModule } from "./misc/misc.module"; @@ -22,9 +21,8 @@ import { TelegramModule } from "./telegram/telegram.module"; BuilderModule, ConfigModule.forRoot({ envFilePath: ".env", isGlobal: true, load: [appConfig] }), LoggerModule.forRoot({ - pinoHttp: { - level: IS_PROD ? "info" : "debug", - }, + // By default, off, but can be enabled by setting HTTP_LOGGING=true + forRoutes: process.env.HTTP_LOGGING === "true" ? undefined : [], }), MetricsModule, MiscModule, diff --git a/backend/src/builder/moleculer.config.ts b/backend/src/builder/moleculer.config.ts index 6b87e78..8671229 100644 --- a/backend/src/builder/moleculer.config.ts +++ b/backend/src/builder/moleculer.config.ts @@ -1,6 +1,5 @@ import type IORedis from "ioredis"; import type { BrokerOptions, LoggerConfig, ServiceSchema } from "moleculer"; -import { IS_PROD } from "../constants"; export const MoleculerConfigCommon: Partial = { skipProcessEventRegistration: true, @@ -10,7 +9,7 @@ export function MoleculerConfigLog(): LoggerConfig { return { type: "Pino", options: { - level: IS_PROD ? "info" : "debug", + level: "error", }, }; } diff --git a/backend/src/config/repo-manager.config.ts b/backend/src/config/repo-manager.config.ts index de6c50d..37778cb 100644 --- a/backend/src/config/repo-manager.config.ts +++ b/backend/src/config/repo-manager.config.ts @@ -1,10 +1,10 @@ import { registerAs } from "@nestjs/config"; export default registerAs("repoMan", () => ({ - gitlabToken: process.env.GITLAB_TOKEN, + alwaysRebuild: process.env.REPOMANAGER_ALWAYS_REBUILD ?? "{}", gitAuthor: process.env.GIT_AUTHOR ?? "Chaotic Temeraire", gitEmail: process.env.GIT_EMAIL ?? "ci@chaotic.cx", gitUsername: process.env.GIT_USERNAME ?? "git", + gitlabToken: process.env.CAUR_GITLAB_TOKEN, schedulerInterval: process.env.REPOMANAGER_SCHEDULE ?? "0 * * * *", - alwaysRebuild: process.env.REPOMANAGER_ALWAYS_REBUILD ?? "{}", })); diff --git a/backend/src/data.source.ts b/backend/src/data.source.ts index 920c769..dbacee3 100644 --- a/backend/src/data.source.ts +++ b/backend/src/data.source.ts @@ -3,6 +3,7 @@ import { Build, Builder, Repo } from "./builder/builder.entity"; import { IS_PROD } from "./constants"; import { Mirror, RouterHit } from "./router/router.entity"; import { User } from "./users/users.entity"; +import { ArchlinuxPackage, RepoManagerSettings } from "./repo-manager/repo-manager.entity"; export const dataSourceOptions: DataSourceOptions = { type: "postgres", @@ -12,7 +13,7 @@ export const dataSourceOptions: DataSourceOptions = { password: process.env.PG_PASSWORD || "chaotic", database: process.env.PG_DATABASE || "chaotic", synchronize: !IS_PROD, - entities: [Builder, Build, Repo, RouterHit, Mirror, User], + entities: [Builder, Build, Repo, RouterHit, Mirror, User, ArchlinuxPackage, RepoManagerSettings], migrations: [], cache: true, extra: { diff --git a/backend/src/main.ts b/backend/src/main.ts index 9810ddf..0ef394f 100644 --- a/backend/src/main.ts +++ b/backend/src/main.ts @@ -15,7 +15,7 @@ process.env.NODE_ENV = process.env.NODE_ENV || "development"; declare const module: any; async function bootstrap(): Promise { - const fastifyAdapter = new FastifyAdapter({ logger: true }); + const fastifyAdapter = new FastifyAdapter(); const app: INestApplication = await NestFactory.create(AppModule, fastifyAdapter, { bufferLogs: true, }); @@ -51,5 +51,5 @@ async function bootstrap(): Promise { } bootstrap().then(() => { - Logger.log("🚀 Application has started up", "Bootstrap"); + Logger.log("🚀 Application has started up.", "Bootstrap"); }); diff --git a/backend/src/repo-manager/repo-manager.service.ts b/backend/src/repo-manager/repo-manager.service.ts index be47f2f..bb5f527 100644 --- a/backend/src/repo-manager/repo-manager.service.ts +++ b/backend/src/repo-manager/repo-manager.service.ts @@ -130,7 +130,7 @@ export class RepoManagerService { } class RepoManager { - status: RepoStatus = RepoStatus.INACTIVE; + status: RepoStatus private readonly cloneDir: string = path.join(process.cwd(), "repos"); private readonly httpService: HttpService; private readonly archlinuxRepos: string[] = ["core", "extra"]; @@ -159,6 +159,7 @@ class RepoManager { this.httpService = httpService; this.dbConnections = dbConnections; this.repoManagerSettings = settings; + this.status = RepoStatus.INACTIVE; Logger.log("RepoManager initialized", "RepoManager"); }