Skip to content

2-在启动之前做好配置

此工程使用 confection 框架解析 爬虫 和 worker 的配置文件。

在第一次执行数据采集时,如果没有在 .data/config.cfg 找到配置文件,则会自动生成一个配置文件在用户家目录下,通过符号链接(symlink)的方式链接到 .data/config.cfg,以便管理和访问。

以下是配置文件模板。

toml
[vars.pg]
# confection 框架支持变量语法
dbname="set to your"
user="set to your"
password="set to your"
host="set to your"
port="set to your"

[camoufox]

[crawler]

[crawler.postgres]
# 垃圾数据将会存入此 Postgres 数据湖。
dbname=${vars.pg.dbname}
user=${vars.pg.user}
password=${vars.pg.password}
host=${vars.pg.host}
port=${vars.pg.port}

[crawler.gecko]
profile-dir-base="{{HOME}}/.libian/crawler/gecko-profile"

[crawler.minio]
endpoint="example.com:18194"
access_key=""
secret_key=""
secure=true
public_endpoint_url="https://example.com:18194"