aboutsummaryrefslogtreecommitdiff
path: root/server/src/config.rs
blob: 0417878148a91aef919a6d32e257f500018c28c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
    This file is part of jellything (https://codeberg.org/metamuffin/jellything)
    which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
    Copyright (C) 2023 metamuffin <metamuffin.org>
*/
use serde::{Deserialize, Serialize};
use std::{collections::HashMap, fs::File, path::PathBuf};

#[derive(Debug, Deserialize, Serialize, Default)]
pub struct GlobalConfig {
    pub brand: String,
    pub slogan: String,

    pub asset_path: PathBuf,
    pub database_path: PathBuf,
    pub library_path: PathBuf,

    pub admin_username: String,
    pub admin_password: String,
    pub cookie_key: String,
    pub login_expire: i64,
    pub remote_credentials: HashMap<String, (String, String)>,
}

pub fn load_global_config() -> GlobalConfig {
    serde_json::from_reader(File::open("data/config.json").unwrap()).unwrap()
}