Add pictrs config

This commit is contained in:
Felix Ableitner 2022-12-28 22:43:26 +01:00
parent a6da447a78
commit 42a62b44dd
5 changed files with 25 additions and 4 deletions

View file

@ -5,3 +5,4 @@ api_tests
ansible
tests
*.sh
pictrs

3
.gitignore vendored
View file

@ -18,3 +18,6 @@ query_testing/**/reports/*.json
# API tests
api_tests/node_modules
# pictrs data
pictrs/

4
Cargo.lock generated
View file

@ -3497,9 +3497,9 @@ dependencies = [
[[package]]
name = "pict-rs"
version = "0.4.0-beta.8"
version = "0.4.0-beta.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "291e07d71ce4989976d6bacccaeda386345a36d3a092f7d14cb221a66573d757"
checksum = "fe0e3978ae576cdd6a4e62676a581a8a9153c6b01c8b70ee93fc489de2684265"
dependencies = [
"actix-form-data",
"actix-rt",

View file

@ -144,5 +144,5 @@ actix-rt = "2.6"
rand = { workspace = true }
console-subscriber = { version = "0.1.8", optional = true }
opentelemetry-otlp = { version = "0.10.0", optional = true }
pict-rs = { version = "0.4.0-beta.8", optional = true }
pict-rs = { version = "0.4.0-beta.9", optional = true }
tokio.workspace = true

View file

@ -8,7 +8,24 @@ pub async fn main() -> Result<(), LemmyError> {
start_lemmy_server().await?;
#[cfg(feature = "embed-pictrs")]
{
pict_rs::init_config::<String, String>(None, None).unwrap();
pict_rs::ConfigSource::memory(serde_json::json!({
"server": {
"address": "127.0.0.1:8080"
},
"old_db": {
"path": "./pictrs/old"
},
"repo": {
"type": "sled",
"path": "./pictrs/sled-repo"
},
"store": {
"type": "filesystem",
"path": "./pictrs/files"
}
}))
.init::<&str>(None)
.expect("initialize pictrs config");
let (lemmy, pictrs) = tokio::join!(start_lemmy_server(), pict_rs::run());
lemmy?;
pictrs.expect("run pictrs");