Redisをオプションにしたり
This commit is contained in:
parent
57e93b9b4e
commit
1117ce4b54
7 changed files with 43 additions and 39 deletions
|
@ -93,11 +93,9 @@ export type Source = {
|
|||
private_key: string;
|
||||
};
|
||||
|
||||
google_maps_api_key: string;
|
||||
|
||||
clusterLimit?: number;
|
||||
|
||||
user_recommendation: {
|
||||
user_recommendation?: {
|
||||
external: boolean;
|
||||
engine: string;
|
||||
timeout: number;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import * as redis from 'redis';
|
||||
import config from '../config';
|
||||
|
||||
export default redis.createClient(
|
||||
export default config.redis ? redis.createClient(
|
||||
config.redis.port,
|
||||
config.redis.host,
|
||||
{
|
||||
auth_pass: config.redis.pass
|
||||
}
|
||||
);
|
||||
) : null;
|
||||
|
|
|
@ -8,6 +8,12 @@ import { IUser } from '../../models/user';
|
|||
const log = debug('misskey:limitter');
|
||||
|
||||
export default (endpoint: IEndpoint, user: IUser) => new Promise((ok, reject) => {
|
||||
// Redisがインストールされてない場合は常に許可
|
||||
if (limiterDB == null) {
|
||||
ok();
|
||||
return;
|
||||
}
|
||||
|
||||
const limitation = endpoint.meta.limit;
|
||||
|
||||
const key = limitation.hasOwnProperty('key')
|
||||
|
|
|
@ -55,7 +55,7 @@ router.get('/disconnect/twitter', async ctx => {
|
|||
}));
|
||||
});
|
||||
|
||||
if (config.twitter == null) {
|
||||
if (config.twitter == null || redis == null) {
|
||||
router.get('/connect/twitter', ctx => {
|
||||
ctx.body = '現在Twitterへ接続できません (このインスタンスではTwitterはサポートされていません)';
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue