add: metadata tetratto_owner_id

This commit is contained in:
trisua 2025-08-25 19:21:09 -04:00
parent be9189a474
commit 8fd5103479
5 changed files with 28 additions and 14 deletions

View file

@ -3,6 +3,12 @@ use pathbufd::PathBufD;
use serde::{Deserialize, Serialize};
use tetratto_shared::hash::random_id;
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct ServiceHostsConfig {
pub tetratto: String,
pub buckets: String,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Config {
/// The name of the site. Shown in the UI.
@ -11,9 +17,6 @@ pub struct Config {
/// The (CSS) theme color of the site. Shown in the UI.
#[serde(default = "default_theme_color")]
pub theme_color: String,
/// The URL of the Tetratto host associated with this instance.
#[serde(default = "default_tetratto")]
pub tetratto: String,
/// The slug of the instance's information page.
///
/// Should be the pathname WITHOUT the leading slash.
@ -29,6 +32,9 @@ pub struct Config {
/// Real IP header (for reverse proxy).
#[serde(default = "default_real_ip_header")]
pub real_ip_header: String,
/// The host URL of required services.
#[serde(default = "default_service_hosts")]
pub service_hosts: ServiceHostsConfig,
/// The master password which is allowed to do anything without password checks.
pub master_pass: String,
}
@ -41,10 +47,6 @@ fn default_theme_color() -> String {
"#a3b3ff".to_string()
}
fn default_tetratto() -> String {
"https://tetratto.com".to_string()
}
fn default_what_page_slug() -> String {
"what".to_string()
}
@ -61,6 +63,13 @@ fn default_real_ip_header() -> String {
"CF-Connecting-IP".to_string()
}
fn default_service_hosts() -> ServiceHostsConfig {
ServiceHostsConfig {
tetratto: "https://tetratto.com".to_string(),
buckets: "https://assetdelivery.tetratto.com".to_string(),
}
}
impl Configuration for Config {
fn db_config(&self) -> DatabaseConfig {
self.database.to_owned()
@ -72,11 +81,11 @@ impl Default for Config {
Self {
name: default_name(),
theme_color: default_theme_color(),
tetratto: default_tetratto(),
what_page_slug: default_what_page_slug(),
tetratto_handler_account_username: default_tetratto_handler_account_username(),
database: default_database(),
real_ip_header: default_real_ip_header(),
service_hosts: default_service_hosts(),
master_pass: random_id(),
}
}