Skip to content

Commit

Permalink
Add pictrs config
Browse files Browse the repository at this point in the history
  • Loading branch information
Nutomic committed Dec 28, 2022
1 parent a7f07e2 commit 05ec968
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 5 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Expand Up @@ -5,3 +5,4 @@ api_tests
ansible
tests
*.sh
pictrs
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -18,3 +18,6 @@ query_testing/**/reports/*.json

# API tests
api_tests/node_modules

# pictrs data
pictrs/
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -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
18 changes: 16 additions & 2 deletions src/main.rs
Expand Up @@ -7,8 +7,22 @@ pub async fn main() -> Result<(), LemmyError> {
#[cfg(not(feature = "embed-pictrs"))]
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");
Expand Down

0 comments on commit 05ec968

Please sign in to comment.