generated from t/malachite
add: bucket default images
This commit is contained in:
parent
bff797569d
commit
71a89e6c44
6 changed files with 93 additions and 7 deletions
|
@ -1,3 +1,5 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use oiseau::config::{Configuration, DatabaseConfig};
|
||||
use pathbufd::PathBufD;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -7,6 +9,9 @@ pub struct Config {
|
|||
/// The directory files are stored in (relative to cwd).
|
||||
#[serde(default = "default_directory")]
|
||||
pub directory: String,
|
||||
/// The path to the default image to be served for the given buckets.
|
||||
#[serde(default = "default_bucket_defaults")]
|
||||
pub bucket_defaults: HashMap<String, (String, String)>,
|
||||
/// Database configuration.
|
||||
#[serde(default = "default_database")]
|
||||
pub database: DatabaseConfig,
|
||||
|
@ -16,6 +21,10 @@ fn default_directory() -> String {
|
|||
"buckets".to_string()
|
||||
}
|
||||
|
||||
fn default_bucket_defaults() -> HashMap<String, (String, String)> {
|
||||
HashMap::new()
|
||||
}
|
||||
|
||||
fn default_database() -> DatabaseConfig {
|
||||
DatabaseConfig::default()
|
||||
}
|
||||
|
@ -30,6 +39,7 @@ impl Default for Config {
|
|||
fn default() -> Self {
|
||||
Self {
|
||||
directory: default_directory(),
|
||||
bucket_defaults: default_bucket_defaults(),
|
||||
database: default_database(),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue