diff options
author | metamuffin <metamuffin@disroot.org> | 2023-10-03 09:31:05 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-10-03 09:31:05 +0200 |
commit | fffc7a3b8a8a3ead3992d400ec9ed035f1f93b39 (patch) | |
tree | 44b7827eeda1ef5a0a9012873a78ba401f7027d1 | |
parent | 1fff4e3828ca0745aaed3d778dcd47f1dfa79cd3 (diff) | |
download | jellything-fffc7a3b8a8a3ead3992d400ec9ed035f1f93b39.tar jellything-fffc7a3b8a8a3ead3992d400ec9ed035f1f93b39.tar.bz2 jellything-fffc7a3b8a8a3ead3992d400ec9ed035f1f93b39.tar.zst |
use yaml for configuration
-rw-r--r-- | Cargo.lock | 22 | ||||
-rw-r--r-- | base/Cargo.toml | 2 | ||||
-rw-r--r-- | base/src/lib.rs | 4 | ||||
-rw-r--r-- | import/Cargo.toml | 1 | ||||
-rw-r--r-- | import/src/main.rs | 4 | ||||
-rw-r--r-- | readme.md | 2 |
6 files changed, 28 insertions, 7 deletions
@@ -1393,7 +1393,7 @@ dependencies = [ "jellycommon", "log", "serde", - "serde_json", + "serde_yaml", "sha2", "tokio", ] @@ -1507,6 +1507,7 @@ dependencies = [ "reqwest", "serde", "serde_json", + "serde_yaml", ] [[package]] @@ -2638,6 +2639,19 @@ dependencies = [ ] [[package]] +name = "serde_yaml" +version = "0.9.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a49e178e4452f45cb61d0cd8cebc1b0fafd3e41929e996cef79aa3aca91f574" +dependencies = [ + "indexmap 2.0.0", + "itoa", + "ryu", + "serde", + "unsafe-libyaml", +] + +[[package]] name = "sha2" version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3182,6 +3196,12 @@ dependencies = [ ] [[package]] +name = "unsafe-libyaml" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28467d3e1d3c6586d8f25fa243f544f5800fec42d97032474e17222c2b75cfa" + +[[package]] name = "url" version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" diff --git a/base/Cargo.toml b/base/Cargo.toml index 03b5055..45c3843 100644 --- a/base/Cargo.toml +++ b/base/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] jellycommon = { path = "../common" } serde = { version = "1.0.188", features = ["derive"] } -serde_json = "1.0.107" +serde_yaml = "0.9.25" log = { workspace = true } sha2 = "0.10.8" base64 = "0.21.4" diff --git a/base/src/lib.rs b/base/src/lib.rs index 062b028..132fd45 100644 --- a/base/src/lib.rs +++ b/base/src/lib.rs @@ -12,11 +12,11 @@ use jellycommon::{config::GlobalConfig, AssetLocation}; use std::{fs::File, path::PathBuf, sync::LazyLock}; pub static CONF: LazyLock<GlobalConfig> = LazyLock::new(|| { - serde_json::from_reader( + serde_yaml::from_reader( File::open( std::env::args() .nth(1) - .expect("First argument must specify the config.json to use."), + .expect("First argument must specify the configuration to use."), ) .unwrap(), ) diff --git a/import/Cargo.toml b/import/Cargo.toml index 89d3ea9..9f0912a 100644 --- a/import/Cargo.toml +++ b/import/Cargo.toml @@ -16,6 +16,7 @@ reqwest = { version = "0.11.20", features = ["blocking", "json"] } serde = { version = "1.0.188", features = ["derive"] } serde_json = "1.0.107" +serde_yaml = "0.9.25" bincode = { version = "2.0.0-rc.3", features = ["serde"] } base64 = "0.21.4" rand = "0.8.5" diff --git a/import/src/main.rs b/import/src/main.rs index f017407..3affabd 100644 --- a/import/src/main.rs +++ b/import/src/main.rs @@ -94,8 +94,8 @@ fn main() -> anyhow::Result<()> { std::fs::create_dir_all(path.join("assets"))?; File::create_new(path.join("assets/front.htm"))? .write_fmt(format_args!("<h1>My very own jellything instance</h1>"))?; - serde_json::to_writer( - File::create_new(path.join("config.json"))?, + serde_yaml::to_writer( + File::create_new(path.join("config.yaml"))?, &GlobalConfig { brand: brand.clone(), slogan: "Creative slogan here".to_string(), @@ -28,7 +28,7 @@ rustup install nightly cargo +nightly install jellything --git https://codeberg.org/metamuffin/jellything.git cargo +nightly install jellything-import --git https://codeberg.org/metamuffin/jellything.git jellything-import init --brand 'Blubflix' data # data will be a directory containing all the instances data -jellything data/config.json +jellything data/config.yaml ``` ## Licence |