feat: add crawler configuration options
This commit is contained in:
parent
e37f335652
commit
7852ae634d
4 changed files with 14 additions and 1 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -1902,6 +1902,7 @@ dependencies = [
|
||||||
"idna",
|
"idna",
|
||||||
"matches",
|
"matches",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
|
"serde 1.0.136",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
@ -16,7 +16,7 @@ lazy_static = "1.4.0"
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
tera = "1.15"
|
tera = "1.15"
|
||||||
tokio = { version = "1.17", features = ["fs", "time"] }
|
tokio = { version = "1.17", features = ["fs", "time"] }
|
||||||
url = "2.2.2"
|
url = { version = "2.2.2", features = ["serde"] }
|
||||||
validator = { version = "0.14", features = ["derive"]}
|
validator = { version = "0.14", features = ["derive"]}
|
||||||
derive_more = "0.99.17"
|
derive_more = "0.99.17"
|
||||||
log = "0.4.16"
|
log = "0.4.16"
|
||||||
|
|
|
@ -31,6 +31,10 @@ name = "postgres"
|
||||||
pool = 4
|
pool = 4
|
||||||
database_type = "postgres"
|
database_type = "postgres"
|
||||||
|
|
||||||
|
[crawler]
|
||||||
|
ttl = 432000 # of crawled records / how often the instance must be polled. In seconds.
|
||||||
|
items_per_api_call = 20
|
||||||
|
client_timeout = 60 # of HTTP client involved in crawling. In seconds.
|
||||||
|
|
||||||
[repository]
|
[repository]
|
||||||
root = "/tmp/starchart.batsense.net"
|
root = "/tmp/starchart.batsense.net"
|
||||||
|
|
|
@ -137,6 +137,13 @@ pub struct Database {
|
||||||
pub database_type: DBType,
|
pub database_type: DBType,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Validate, Clone, Deserialize)]
|
||||||
|
pub struct Crawler {
|
||||||
|
pub ttl: u64,
|
||||||
|
pub client_timeout: u64,
|
||||||
|
pub items_per_api_call: u64,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Validate, Clone, Deserialize)]
|
#[derive(Debug, Validate, Clone, Deserialize)]
|
||||||
pub struct Settings {
|
pub struct Settings {
|
||||||
pub log: LogLevel,
|
pub log: LogLevel,
|
||||||
|
@ -148,6 +155,7 @@ pub struct Settings {
|
||||||
pub repository: Repository,
|
pub repository: Repository,
|
||||||
#[validate(email)]
|
#[validate(email)]
|
||||||
pub admin_email: String,
|
pub admin_email: String,
|
||||||
|
pub crawler: Crawler,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(tarpaulin_include))]
|
#[cfg(not(tarpaulin_include))]
|
||||||
|
|
Loading…
Add table
Reference in a new issue