From 03fa944cbb64c255057d7c546858a8e7c104dc07 Mon Sep 17 00:00:00 2001 From: Aravinth Manivannan Date: Fri, 9 Dec 2022 14:10:41 +0530 Subject: [PATCH] feat: init. basic configuration schema --- .gitignore | 2 ++ Cargo.toml | 16 ++++++++++++++++ src/lib.rs | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.toml create mode 100644 src/lib.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4fffb2f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/target +/Cargo.lock diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..0668cec --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "libconfig" +version = "0.1.0" +edition = "2021" +homepage = "https://git.batsense.net/librepages/libconfig" +repository = "https://git.batsense.net/librepages/libconfig" +documentation = "https://github.con/librepages/libconfig" +readme = "https://git.batsense.net/librepages/libconfig/blob/master/README.md" +license = "AGPLv3 or later version" +authors = ["realaravinth "] + + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +serde = { version = "1.0.147", features = ["derive"]} diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..762938c --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2022 Aravinth Manivannan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +use serde::{Deserialize, Serialize}; + +#[derive(Deserialize, Serialize, Debug, Eq, PartialEq, Clone)] +pub struct Config { + pub source: Source, + pub domains: Option>, + pub forms: Option, + pub image_compression: Option, + pub redirects: Option>, +} + +#[derive(Deserialize, Serialize, PartialEq, Eq, Debug, Clone)] +pub struct Source { + production_branch: String, + staging: Option, +} + +#[derive(Deserialize, Serialize, PartialEq, Eq, Debug, Clone)] +pub struct Forms { + pub enable: bool, +} + +#[derive(Deserialize, Serialize, PartialEq, Eq, Debug, Clone)] +pub struct ImageCompression { + pub enable: bool, +} + +#[derive(Deserialize, Serialize, PartialEq, Eq, Debug, Clone)] +pub struct Redirects { + pub from: String, + pub to: String, +}