Check config on load (#4170)

Co-authored-by: syuilo <syuilotan@yahoo.co.jp>
This commit is contained in:
Aya Morisawa
2019-02-06 22:44:55 +09:00
committed by syuilo
parent 41ba06a5e6
commit 96bc17aa10
19 changed files with 195 additions and 125 deletions

View File

@ -8,17 +8,17 @@ import handler from './processors';
import { queueLogger } from './logger';
const enableQueue = !program.disableQueue;
const queueAvailable = config.redis != null;
const queueAvailable = config.redis.isJust();
const queue = initializeQueue();
function initializeQueue() {
if (queueAvailable) {
return config.redis.map(({ port, host, pass }) => {
return new Queue('misskey', {
redis: {
port: config.redis.port,
host: config.redis.host,
password: config.redis.pass
port: port,
host: host,
password: pass.getOrElse(null)
},
removeOnSuccess: true,
@ -27,9 +27,7 @@ function initializeQueue() {
sendEvents: false,
storeJobs: false
});
} else {
return null;
}
}).getOrElse(null);
}
export function deliver(user: ILocalUser, content: any, to: any) {