Skip to content

Commit

Permalink
setup crowi instance
Browse files Browse the repository at this point in the history
  • Loading branch information
yuki-takei committed Aug 1, 2024
1 parent 97119e5 commit a5a519a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions apps/app/src/server/repl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import mongoose from 'mongoose';

import { getMongoUri, mongoOptions } from '~/server/util/mongoose-utils';

import Crowi from './crowi';


const setupMongoose = async(replServer: REPLServer) => {
mongoose.Promise = global.Promise;
Expand All @@ -18,12 +20,10 @@ const setupMongoose = async(replServer: REPLServer) => {
};


const setupModels = async(replServer: REPLServer) => { // eslint-disable-line @typescript-eslint/no-unused-vars
const models = require('./models');

Object.keys(models).forEach((modelName) => {
global[modelName] = models[modelName];
});
const setupCrowi = async(replServer: REPLServer) => {
const crowi = new Crowi();
await crowi.init();
replServer.context.crowi = crowi;
};

const start = async() => {
Expand All @@ -33,7 +33,7 @@ const start = async() => {
});

await setupMongoose(replServer);
await setupModels(replServer);
await setupCrowi(replServer);
};

start();

0 comments on commit a5a519a

Please sign in to comment.