This commit is contained in:
syuilo 2023-05-24 09:59:30 +09:00
parent acdcd7c623
commit ed902658a9
1 changed files with 5 additions and 5 deletions

View File

@ -4,7 +4,7 @@ import * as Redis from 'ioredis';
import { DataSource } from 'typeorm'; import { DataSource } from 'typeorm';
import { MeiliSearch } from 'meilisearch'; import { MeiliSearch } from 'meilisearch';
import { DI } from './di-symbols.js'; import { DI } from './di-symbols.js';
import { loadConfig } from './config.js'; import { Config, loadConfig } from './config.js';
import { createPostgresDataSource } from './postgres.js'; import { createPostgresDataSource } from './postgres.js';
import { RepositoryModule } from './models/RepositoryModule.js'; import { RepositoryModule } from './models/RepositoryModule.js';
import type { Provider, OnApplicationShutdown } from '@nestjs/common'; import type { Provider, OnApplicationShutdown } from '@nestjs/common';
@ -25,7 +25,7 @@ const $db: Provider = {
const $meilisearch: Provider = { const $meilisearch: Provider = {
provide: DI.meilisearch, provide: DI.meilisearch,
useFactory: (config) => { useFactory: (config: Config) => {
if (config.meilisearch) { if (config.meilisearch) {
return new MeiliSearch({ return new MeiliSearch({
host: `${config.meilisearch.ssl ? 'https' : 'http' }://${config.meilisearch.host}:${config.meilisearch.port}`, host: `${config.meilisearch.ssl ? 'https' : 'http' }://${config.meilisearch.host}:${config.meilisearch.port}`,
@ -40,7 +40,7 @@ const $meilisearch: Provider = {
const $redis: Provider = { const $redis: Provider = {
provide: DI.redis, provide: DI.redis,
useFactory: (config) => { useFactory: (config: Config) => {
return new Redis.Redis({ return new Redis.Redis({
port: config.redis.port, port: config.redis.port,
host: config.redis.host, host: config.redis.host,
@ -55,7 +55,7 @@ const $redis: Provider = {
const $redisForPub: Provider = { const $redisForPub: Provider = {
provide: DI.redisForPub, provide: DI.redisForPub,
useFactory: (config) => { useFactory: (config: Config) => {
const redis = new Redis.Redis({ const redis = new Redis.Redis({
port: config.redisForPubsub.port, port: config.redisForPubsub.port,
host: config.redisForPubsub.host, host: config.redisForPubsub.host,
@ -71,7 +71,7 @@ const $redisForPub: Provider = {
const $redisForSub: Provider = { const $redisForSub: Provider = {
provide: DI.redisForSub, provide: DI.redisForSub,
useFactory: (config) => { useFactory: (config: Config) => {
const redis = new Redis.Redis({ const redis = new Redis.Redis({
port: config.redisForPubsub.port, port: config.redisForPubsub.port,
host: config.redisForPubsub.host, host: config.redisForPubsub.host,