This repository was archived by the owner on Aug 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
II.1. Configuration
Andrey Bogdanov edited this page Feb 24, 2016
·
21 revisions
Create config.json. You may also create another configuration files (config.json and config-dev.json are git-ignored) and specify them as command line parameters:
./app.js ./config-dev.json
or
./app.js /absolute/path/to/your-config.json
See config.json.example or config-dev.json.example for examples.
{
"system": {
"workerCount": 1, /*Number of worker processes.
Defaults to CPU core count.*/
"log": {
"targets": [ /*Log targets. Possible values: "console", "file".
Defaults to ["console", "file"].*/
"console",
"file"
],
"maxSize": 1048576, /*Maximum log file size. When exceeding the size,
the file is backed up and a new one is created.
Defaults to 1 MB (1048576 bytes)*/
"backups": 100, /*Maximum number of backed up log files.
Defaults to 100.*/
"middleware": {
"before": "", /*Possible values: "none" (do not log),
"request" (log requests that passed middlewares),
"middleware" (log before normal middlewares),
"static" (log before serving static files),
"all" (log before any middleware).
Defaults to "none".*/
"verbosity": "ip" /*Possible values: "none" (do not log),
"ip" (IP only), "path" (IP+path),
"all" (IP+path+query).
Defaults to "ip".*/
"exclude": [ /*List of paths of requests
that do not need to be logged*/
{ "string": "/action/deletePost" }, /*Exact match.*/
{ /*Regular expression match.*/
"regexp": "^/action/create[a-z]+$",
"flags": "i"
}
],
}
},
"fileDownloadProxy": "", /*Proxy used to download files attached by link.
Example: 123.45.57.89:8080.*/
"fileDownloadProxyAuth": "", /*Proxy user/password.
Example: user:password.*/
"searchLimit": 100, /*Maximum number of posts returned for a search
query. Used to prevent attacks using
highly resource-consuming search system.*/
"tmpPath": "", /*Path to temporary files (HTML/JSON cache and uploads).
By default it is the ./tmp subdirectory.*/
"regenerateCacheOnStartup": false, /*If true, the cache will be
regenerated on every startup.*/
"redis": { /*Redis connection options. Below are the defaults.
Please, refer to Redis documentation for details.*/
"port": 6379,
"host": "127.0.0.1",
"family": 4,
"password": "",
"db": 0
}
},
"server": {
"port": 8080, /*The port to listen to.*/
"ddosProtection": { /*See: https://www.npmjs.com/package/ddos-express*/
"enabled": true, /*Enable/disable simple DDoS protection.
By default it is enabled.*/
"static": false, /*Protect static files against DDoS.
Disabled by default.*/
"errorData": "Not so fast!", /*Error message returned when
DDoS is recognized. May be HTML.*/
"errorCode": 429, /*Error code set when DDoS is recognized.*/
"weight": 1, /*Default request weight.*/
"maxWeight": 10, /*Maximum allowed request weight.*/
"checkInterval": 1000, /*Interval of checking weights
(in milliseconds).*/
"rules": [
{
"regexp": "^/api.*", /*Regular-expression-based rule.*/
"maxWeight": 6, /*Maximum allowed weight for this path.*/
"queueSize": 4 /*Up to 4 requests will be added to the
request queue.*/
},
{
"string": "/action/search", /*String-based rule
(exact match).*/
"maxWeight": 1
},
{
"regexp": ".*",
"maxWeight": 16
}
]
},
"rss": {
"enabled": true, /*Enable RSS feed generation.
By default it is enabled.*/
"ttl": 60, /*Time (in minutes) after the lapse of which
RSS is generated again.*/
"postCount": 500 /*Maximum post count int the feed.*/
},
"chat": {
"ttl": 10080 /*Time (in minutes) after which private chat messages
are deleted if chat is inactive.*/
},
"youtubeApiKey": "" /*YouTube API key for video information retrieving.*/
},
"permissions": { /*User action permissions.*/
"seeUserIp": "ADMIN" /*Determines which users may see other users IPs.*/
},
"site": {
"locale": "en", /*The site will be localized using this locale.*/
"protocol": "http", /*Default site protocol.
If your site enorces SSL/TLS, change it to https.*/
"domain": "localhost:8080", /*Your site domain name.
You must change this.*/
"pathPrefix": "", /*Should be specified if there are several sites
running on the same host.*/
"dateFormat": "MM/DD/YYYY HH:mm:ss", /*Most of the dates on the site
will be formatted using this.*/
"timeOffset": 0, /*Server GMT time offset.*/
"tripcodeSalt": "ololo", /*Salt added to user hashpass when generating
tripcodes. Change this to some secret string.*/
"maxSearchQueryLength": 50, /*Maximum allowed search query length.*/
"vkontakte": {
"integrationEnabled": false, /*Enables Vkontakte
(Russian social network) integration.
See also /markup.html*/
"appId": 0, /*Refer to https://vk.com/dev/main*/
"accessToken": "" /*Acquiring a token is described below.*/
},
"twitter": {
"integrationEnabled": true /*Allows integration of twits into pages
by simply pasting the links.
See also /markup.html*/
},
"extraScripts": { /*Allows to add custom scripts to pages.*/
"boardPage": [ /*Pages are specified by template names.*/
{ "fileName": "custom/myScript.js" }, /*Local script file name.*/
{ "source": "http://ajax.aspnetcdn.com/ajax/jquery.validate/1.14.0/jquery.validate.min.js" } /*External script file link.*/
]
}
},
"board": {
"bumpLimit": 500, /*Number of posts after which a thread stops being
bumped when new posts are added.*/
"postLimit": 1000, /*Maximum number of posts per one thread.*/
"threadLimit": 200, /*Maximum number of threads per board.*/
/*Archival threads does not count.*/
"threadsPerPage": 20, /*Well, that's obvious.*/
"archiveLimit": 0, /*Maximum number of threads to be archived.*/
"captchaEnabled": true, /*Enable/disable captcha. Defaults to true.*/
"captchaQuota": 10, /*Number of posts a user can make after solving
captcha. The post made when solving captcha
does NOT count. (So in this case we actually have
11 posts per one captcha).*/
"launchDate": "", /*Site launch date in ISO date format.*/
"maxFileSize": 15728640, /*Maximum file size in bytes
(1 KB is 1024 bytes).*/
"b": {
"captchaQuota": 0 /*Overwrites global board settings.*/
},
"soc": {
"hidden": true, /*The board will not appear in navigation bar,
but will be accessible by URL.*/
"launchDate": "" /*This specific board launch date.*/
},
"int": {
"showWhois": true /*Information about poster location
(country/city/flag) will be shown.*/
},
"rf": {
"postingEnabled": false /*Enable/disable posting on a board.*/
},
"3dpd": {
"maxFileCount": 3 /*Maximum file count per post. Defaults to 1.*/
},
"echo": {
"acceptedExternalBoardLinks": [
"http://iichan.hk/[a-z]+/res/\\d+\\.html",
"http://dobrochan.ru/[a-z]+/res/\\d+\\.xhtml",
"https?://410chan.org/[a-z]+/res/\\d+\\.html",
"https://boards.4chan.org/[a-z]+/thread/\\d+/[a-zA-Z0-9\\-_]+",
"https?://2ch.hk/[a-z]+/res/\\d+\\.html"
] /*Accepted external thread links. Specific to /echo/ board.*/
}
},
"captcha": {
"google-recaptcha": {
"privateKey": "", /*Captcha private key*/
"publicKey": "" /*Captcha public key (will be available to users)*/
},
"google-recaptcha-v1": {
"privateKey": "",
"publicKey": ""
},
"yandex-captcha-elatm": {
"privateKey": ""
},
"yandex-captcha-estd": {
"privateKey": ""
},
"yandex-captcha-rus": {
"privateKey": ""
},
"codecha": {
"privateKey": "",
"publicKey": ""
}
}
}
To acquire Vkontakte access token, use this link:
https://oauth.vk.com/authorize?client_id=YOUR_VK_APP_ID&scope=audio,offline&redirect_uri=https://oauth.vk.com/blank.html&display=mobile&response_type=token
and then copy the token from the address line:
https://oauth.vk.com/blank.html#access_token=ACCESS_TOKEN&expires_in=0&user_id=YOUR_VK_USER_ID