Redisをオプションにしたり

This commit is contained in:
syuilo 2018-10-11 15:50:27 +09:00
parent 57e93b9b4e
commit 1117ce4b54
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
7 changed files with 43 additions and 39 deletions

View file

@ -60,11 +60,6 @@ mongodb:
user: example-misskey-user user: example-misskey-user
pass: example-misskey-pass pass: example-misskey-pass
redis:
host: localhost
port: 6379
pass: example-pass
# Drive capacity of a local user (MB) # Drive capacity of a local user (MB)
localDriveCapacityMb: 256 localDriveCapacityMb: 256
@ -122,6 +117,12 @@ drive:
# Below settings are optional # Below settings are optional
# #
# Redis
#redis:
# host: localhost
# port: 6379
# pass: example-pass
# Elasticsearch # Elasticsearch
#elasticsearch: #elasticsearch:
# host: localhost # host: localhost
@ -137,12 +138,10 @@ drive:
#sw: #sw:
# # Public key of VAPID # # Public key of VAPID
# public_key: example-sw-public-key # public_key: example-sw-public-key
#
# # Private key of VAPID # # Private key of VAPID
# private_key: example-sw-private-key # private_key: example-sw-private-key
# google_maps_api_key: example-google-maps-api-key
# Twitter integration # Twitter integration
# You need to set the oauth callback url as : https://<your-misskey-instance>/api/tw/cb # You need to set the oauth callback url as : https://<your-misskey-instance>/api/tw/cb
#twitter: #twitter:
@ -161,8 +160,7 @@ drive:
#summalyProxy: "http://example.com" #summalyProxy: "http://example.com"
# User recommendation # User recommendation
user_recommendation: #user_recommendation:
external: true # external: true
engine: http://vinayaka.distsn.org/cgi-bin/vinayaka-user-match-misskey-api.cgi?{{host}}+{{user}}+{{limit}}+{{offset}} # engine: http://vinayaka.distsn.org/cgi-bin/vinayaka-user-match-misskey-api.cgi?{{host}}+{{user}}+{{limit}}+{{offset}}
timeout: 300000 # timeout: 300000

View file

@ -24,12 +24,12 @@ Please install and setup these softwares:
#### Dependencies :package: #### Dependencies :package:
* **[Node.js](https://nodejs.org/en/)** * **[Node.js](https://nodejs.org/en/)**
* **[MongoDB](https://www.mongodb.com/)** >= 3.6 * **[MongoDB](https://www.mongodb.com/)** >= 3.6
* **[Redis](https://redis.io/)**
##### Optional ##### Optional
* [Redis](https://redis.io/)
* Redis is optional, but we strongly recommended to install it
* [Elasticsearch](https://www.elastic.co/) - used to provide searching feature instead of MongoDB * [Elasticsearch](https://www.elastic.co/) - used to provide searching feature instead of MongoDB
*3.* Setup MongoDB *3.* Setup MongoDB
---------------------------------------------------------------- ----------------------------------------------------------------
In root : In root :

View file

@ -24,9 +24,11 @@ adduser --disabled-password --disabled-login misskey
#### 依存関係 :package: #### 依存関係 :package:
* **[Node.js](https://nodejs.org/en/)** * **[Node.js](https://nodejs.org/en/)**
* **[MongoDB](https://www.mongodb.com/)** (3.6以上) * **[MongoDB](https://www.mongodb.com/)** (3.6以上)
* **[Redis](https://redis.io/)**
##### オプション ##### オプション
* [Redis](https://redis.io/)
* Redisはオプションですが、インストールすることを強く推奨します。
* インストールしなくていいのは、あなたのインスタンスが自分専用のときだけです
* [Elasticsearch](https://www.elastic.co/) - 検索機能を向上させるために用います。 * [Elasticsearch](https://www.elastic.co/) - 検索機能を向上させるために用います。
*3.* MongoDBの設定 *3.* MongoDBの設定

View file

@ -93,11 +93,9 @@ export type Source = {
private_key: string; private_key: string;
}; };
google_maps_api_key: string;
clusterLimit?: number; clusterLimit?: number;
user_recommendation: { user_recommendation?: {
external: boolean; external: boolean;
engine: string; engine: string;
timeout: number; timeout: number;

View file

@ -1,10 +1,10 @@
import * as redis from 'redis'; import * as redis from 'redis';
import config from '../config'; import config from '../config';
export default redis.createClient( export default config.redis ? redis.createClient(
config.redis.port, config.redis.port,
config.redis.host, config.redis.host,
{ {
auth_pass: config.redis.pass auth_pass: config.redis.pass
} }
); ) : null;

View file

@ -8,6 +8,12 @@ import { IUser } from '../../models/user';
const log = debug('misskey:limitter'); const log = debug('misskey:limitter');
export default (endpoint: IEndpoint, user: IUser) => new Promise((ok, reject) => { export default (endpoint: IEndpoint, user: IUser) => new Promise((ok, reject) => {
// Redisがインストールされてない場合は常に許可
if (limiterDB == null) {
ok();
return;
}
const limitation = endpoint.meta.limit; const limitation = endpoint.meta.limit;
const key = limitation.hasOwnProperty('key') const key = limitation.hasOwnProperty('key')

View file

@ -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 => { router.get('/connect/twitter', ctx => {
ctx.body = '現在Twitterへ接続できません (このインスタンスではTwitterはサポートされていません)'; ctx.body = '現在Twitterへ接続できません (このインスタンスではTwitterはサポートされていません)';
}); });