Skip to content
This repository has been archived by the owner on Sep 3, 2022. It is now read-only.

Configuration

Shimizu edited this page Apr 5, 2020 · 11 revisions

Configuration

The ena_config.json file specifies properties in which to connect to a database and poll boards with various settings. Environment variables are also provided and override the json fields where applicable.

The JSON Attributes

Attribute Type Description Environment Variable Default
engine string The database engine to use. Can be one of the following: postgresql | timescaledb | mysql | innodb | tokudb ENA_DATABASE postgresql
database string The name of the database ENA_DATABASE_NAME archive_ena
schema string The schema to use ENA_DATABASE_SCHEMA public
host string The ip address for the database server ENA_DATABASE_HOST localhost
port integer The port number for the database server ENA_DATABASE_PORT 5432
username string The username for the database ENA_DATABASE_USERNAME postgres
password string The password for the database ENA_DATABASE_PASSWORD pass
charset string The charset of the database ENA_DATABASE_CHARSET utf8
path string The folder path to store downloaded media ENA_PATH ./archive
userAgent string The user agent to use for HTTP requests ENA_USERAGENT ena/0.0.0
apiUrl string API endpoint ENA_API_URL https://a.4cdn.org
mediaUrl string Media API endpoint ENA_MEDIA_URL https://i.4cdn.org
dbUrl string The database URL to connect with. This takes priority against the fields above. ENA_DB_URL
asagiMode bool Use the Asagi schema alongside MySQL. strictMode must be set to true ENA_ASAGI_MODE false
strictMode bool Toggle fetching threads sequentially (true) or concurrently (false) ENA_STRICT_MODE false
board string Board name
retryAttempts integer Retry the HTTP request for the specified amount if an error occurs 3
refreshDelay integer Time in seconds between fetching board updates (board ratelimit) 20
throttleMillisec integer Time in milliseconds between fetching each thread (ratelimit) 1000
downloadArchives bool Whether to download the archives for the board true
downloadMedia bool Whether to download and hash (sha256) the media false
downloadThumbnails bool Whether to download and hash (sha256) the media thumbnails false
keepMedia bool Whether to keep the downloaded media on disk false
keepThumbnails bool Whether to keep the downloaded media thumbnails on disk false

Example file

{
  "settings": {
    "engine": "postgresql",
    "database": "archive_4chan",
    "schema": "asagi",
    "host": "localhost",
    "port": 5432,
    "username": "postgres",
    "password": "zxc",
    "charset": "utf8",
    "path": "./archive",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Firefox/68.0",
    "apiUrl": "https://a.4cdn.org",
    "mediaUrl": "https://i.4cdn.org",
    "asagiMode": false,
    "strictMode": false
  },
  "boardSettings": {
    "retryAttempts": 3,
    "refreshDelay": 20,
    "throttleMillisec": 1000,
    "downloadArchives": true,
    "downloadMedia": false,
    "downloadThumbnails": false,
    "keepMedia": false,
    "keepThumbnails": false
  },
  "boards": [
    { "board": "fit" },
    { "board": "out" },
    {
      "board": "a",
      "downloadThumbnails": true,
      "keepThumbnails": true
    },
    {
      "board": "g",
      "refreshDelay": 30
    }
  ]
}

boardSettings is the default settings for all boards listed in the boards array. To override any attribute, just specify them in the specific board.

Extra Environment Variables

Environment Variable Example Default Description
ENA_LOG ena=info Sets the level of process output. It is recommended to set this value to ena=info if you want to see text output. More information can be viewed from the log documentation.
ENA_RESUME true or false Whether to skip (re)downloading the list of cached live threads (~150 of them) + new threads on each restart of the program. The default behavior is false or not set as it prevents loss of data from hiatuses.
Clone this wiki locally