Skip to content
This repository was archived by the owner on Aug 6, 2022. It is now read-only.

II.1. Configuration

Andrey Bogdanov edited this page Feb 25, 2016 · 21 revisions

Refer to I.4. Basic configuration for instructions on how to create a configuration file.

Configuration options

system.workerCount

Worker process count.

Defaults to CPU core count (it is the optimal value and sould not be changed normally).

system.log.targets

An array of log targets.

Defaults to ["console", "file"].

Possible array values:

  • "console"
  • "file"

log4js is used for logging. Log files are stored in the logs directory (logs/ololord.log).

system.log.maxSize

Maximum log file size.

Defaults to 1048576 (1 MB).

If a log file exceeds maximum size, it is renamed (ololord.log.1), and a new empty ololord.log file is created.

system.log.backups

Number of renamed log files to keep.

Defaults to 100.

system.log.middleware.before

Point of logging at the middleware level.

Defaults to "ddos".

Possible values:

  • "all" Log immediately when an incoming request fires (not recommended; use for debug purposes only).
  • "ddos" Log after the request IP address has been mormalized, and before the DDoS protection middleware is reached (recommended).
  • "static" Log after the request has passed DDoS protection middleware, and before static content serving middleware is reached (recommended if a DDoS attack causes log files to become pollutted with denied requests).
  • "middleware" Log after the request has passed static content serving middleware, and before other middlewares are reached (recommended if static content request logs pollute the log file too much).
  • "request" Log after the request has passed all middlewares, and before the Express router is reached.
system.log.middleware.excludes
system.log.middleware.verbosity
``
``

Configuration example

Note: See also config.json.example for an example.

Actual file name must be config.json.

Example:

{
    "system": {
        "workerCount": 1,
        "log": {
            "targets": [
                "console",
                "file"
            ],
            "maxSize": 1048576,
            "backups": 100,
            "middleware": {
                "before": "ddos",
                "exclude": [
                    { "string": "/action/deletePost" },
                    {
                        "regexp": "^/action/create[a-z]+$",
                        "flags": "i"
                    }
                ],
                "verbosity": "all"
            }
        },
        "fileDownloadProxy": "",
        "fileDownloadProxyAuth": "",
        "searchLimit": 100,
        "tmpPath": "/tmp/ramdisk",
        "regenerateCacheOnStartup": false,
        "redis": {
            "port": 6379,
            "host": "127.0.0.1",
            "family": 4,
            "password": "",
            "db": 0
        }
    },
    "server": {
        "port": 8080,
        "ddosProtection": {
            "enabled": true,
            "static": false,
            "errorData": "Not so fast!",
            "errorCode": 429,
            "weight": 1,
            "maxWeight": 10,
            "checkInterval": 1000,
            "rules": [
                {
                    "regexp": "^/api.*",
                    "maxWeight": 6,
                    "queueSize": 4
                },
                {
                    "string": "/action/search",
                    "maxWeight": 1
                },
                {
                    "regexp": ".*",
                    "maxWeight": 16
                }
            ]
        },
        "rss": {
            "enabled": true,
            "ttl": 60,
            "postCount": 500
        },
        "chat": {
            "ttl": 10080
        },
        "youtubeApiKey": ""
    },
    "permissions": {
        "seeUserIp": "ADMIN"
    },
    "site": {
        "locale": "en",
        "protocol": "http",
        "domain": "localhost:8080",
        "dateFormat": "MM/DD/YYYY HH:mm:ss",
        "timeOffset": 0,
        "tripcodeSalt": "ololo",
        "maxSearchQueryLength": 50,
        "vkontakte": {
            "integrationEnabled": false,
            "appId": "Your VK app ID",
            "accessToken": "Your VK access token"
        },
        "twitter": {
            "integrationEnabled": true
        },
        "extraScripts": {
            "boardPage": [
                { "fileName": "custom/myScript.js" },
                { "source": "http://ajax.aspnetcdn.com/ajax/jquery.validate/1.14.0/jquery.validate.min.js" }
            ]
        }
    },
    "board": {
        "bumpLimit": 500,
        "postLimit": 1000,
        "threadLimit": 200,
        "threadsPerPage": 20,
        "archiveLimit": 1000,
        "captchaEnabled": true,
        "captchaQuota": 10,
        "launchDate": "2015-02-12T21:00:00",
        "maxFileSize": 15728640,
        "b": {
            "captchaQuota": 0
        },
        "soc": {
            "hidden": true,
            "launchDate": "2015-02-16T20:00:00"
        },
        "int": {
            "showWhois": true
        },
        "rf": {
            "postingEnabled": false
        },
        "3dpd": {
            "maxFileCount": 3
        },
        "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"
            ]
        }
    },
    "captcha": {
        "google-recaptcha": {
            "privateKey": "Your Google reCAPTCHA private key",
            "publicKey": "Your Google reCAPTCHA public key"
        },
        "google-recaptcha-v1": {
            "privateKey": "Your Google reCAPTCHA v1 private key",
            "publicKey": "Your Google reCAPTCHA v1 public key"
        },
        "yandex-captcha-elatm": {
            "privateKey": "Your Yandex captcha private key"
        },
        "yandex-captcha-estd": {
            "privateKey": "Your Yandex captcha private key"
        },
        "yandex-captcha-rus": {
            "privateKey": "Your Yandex captcha private key"
        },
        "codecha": {
            "privateKey": "Your Codecha private key",
            "publicKey": "Your Codecha public key"
        }
    }
}

Acquiring Vkontakte access token

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

Clone this wiki locally