1
0
Fork 0
mirror of https://codeberg.org/icewind/haze.git synced 2026-06-03 09:04:12 +02:00

allow custom pre-setup config options

This commit is contained in:
Robin Appelman 2026-03-09 18:42:43 +01:00
commit b3a1e80f6f
5 changed files with 25 additions and 5 deletions

View file

@ -321,6 +321,7 @@ disable_apps = ["contacts"] # apps to disable after setup, defaults to []
post_setup = [# commands to execute after setup, defaults to []
"occ group:add test",
]
config = { "foo" = "bar" } # configuration options to set before install
[[volume]] # optional
source = "/tmp/haze-shared"

View file

@ -12,7 +12,7 @@ with lib; let
app_directories = cfg.appDirectories;
work_dir = cfg.workDir;
auto_setup = {
enabled = cfg.autoSetup.enable;
inherit (cfg.autoSetup) enable config;
post_setup = cfg.autoSetup.postSetup;
enable_apps = cfg.autoSetup.enableApps;
disable_apps = cfg.autoSetup.disableApps;
@ -91,6 +91,13 @@ in {
default = [];
description = "Commands to run post-setup";
};
config = mkOption {
type = types.submodule {
freeformType = format.type;
};
description = "Configuration options to set before install";
default = {};
};
};
};
};

View file

@ -9,8 +9,8 @@ if (file_exists(__DIR__ . '/nextcloud.json')) {
$CONFIG = array_merge_recursive($extra_config, [
'debug' => true,
'memcache.local' => '\\OC\\Memcache\\APCu',
'memcache.distributed' => '\\OC\\Memcache\\APCu',
'memcache.locking' => '\\OC\\Memcache\\APCu',
'memcache.distributed' => '\\OC\\Memcache\\Redis',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'allow_local_remote_servers' => true,
'trusted_domains' => ['cloud'],
'profiling.secret' => 'haze',

View file

@ -15,7 +15,7 @@ use flate2::read::GzDecoder;
use futures_util::future::try_join_all;
use miette::{IntoDiagnostic, Report, Result, WrapErr};
use petname::petname;
use serde_json::{Map, Value};
use serde_json::Value;
use std::borrow::Cow;
use std::collections::HashMap;
use std::fmt::Display;
@ -297,7 +297,15 @@ impl Cloud {
.wrap_err_with(|| format!("Failed to setup work directory {}", mapping.source))?;
}
let mut nc_config = Value::Object(Map::new());
let mut nc_config = Value::Object(
config
.auto_setup
.config
.clone()
.into_iter()
.map(|(key, value)| (key, serde_json::to_value(value).unwrap()))
.collect(),
);
nc_config["apps_paths"] = Value::Array(
once("apps")
.chain(

View file

@ -7,6 +7,7 @@ use std::convert::TryFrom;
use std::env::home_dir;
use std::fs::read_to_string;
use std::net::IpAddr;
use toml::map::Map;
use toml::Value;
#[derive(Debug, Deserialize, Default)]
@ -87,6 +88,8 @@ pub struct HazeAutoSetupConfig {
pub disable_apps: Vec<String>,
#[serde(default)]
pub post_setup: Vec<String>,
#[serde(default)]
pub config: Map<String, Value>,
}
impl Default for HazeAutoSetupConfig {
@ -98,6 +101,7 @@ impl Default for HazeAutoSetupConfig {
enable_apps: Vec::default(),
disable_apps: Vec::default(),
post_setup: Vec::default(),
config: Map::default(),
}
}
}