mirror of
https://codeberg.org/icewind/haze.git
synced 2026-06-03 17:14:08 +02:00
allow custom pre-setup config options
This commit is contained in:
parent
80d71bd7a0
commit
b3a1e80f6f
5 changed files with 25 additions and 5 deletions
|
|
@ -321,6 +321,7 @@ disable_apps = ["contacts"] # apps to disable after setup, defaults to []
|
||||||
post_setup = [# commands to execute after setup, defaults to []
|
post_setup = [# commands to execute after setup, defaults to []
|
||||||
"occ group:add test",
|
"occ group:add test",
|
||||||
]
|
]
|
||||||
|
config = { "foo" = "bar" } # configuration options to set before install
|
||||||
|
|
||||||
[[volume]] # optional
|
[[volume]] # optional
|
||||||
source = "/tmp/haze-shared"
|
source = "/tmp/haze-shared"
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ with lib; let
|
||||||
app_directories = cfg.appDirectories;
|
app_directories = cfg.appDirectories;
|
||||||
work_dir = cfg.workDir;
|
work_dir = cfg.workDir;
|
||||||
auto_setup = {
|
auto_setup = {
|
||||||
enabled = cfg.autoSetup.enable;
|
inherit (cfg.autoSetup) enable config;
|
||||||
post_setup = cfg.autoSetup.postSetup;
|
post_setup = cfg.autoSetup.postSetup;
|
||||||
enable_apps = cfg.autoSetup.enableApps;
|
enable_apps = cfg.autoSetup.enableApps;
|
||||||
disable_apps = cfg.autoSetup.disableApps;
|
disable_apps = cfg.autoSetup.disableApps;
|
||||||
|
|
@ -91,6 +91,13 @@ in {
|
||||||
default = [];
|
default = [];
|
||||||
description = "Commands to run post-setup";
|
description = "Commands to run post-setup";
|
||||||
};
|
};
|
||||||
|
config = mkOption {
|
||||||
|
type = types.submodule {
|
||||||
|
freeformType = format.type;
|
||||||
|
};
|
||||||
|
description = "Configuration options to set before install";
|
||||||
|
default = {};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ if (file_exists(__DIR__ . '/nextcloud.json')) {
|
||||||
$CONFIG = array_merge_recursive($extra_config, [
|
$CONFIG = array_merge_recursive($extra_config, [
|
||||||
'debug' => true,
|
'debug' => true,
|
||||||
'memcache.local' => '\\OC\\Memcache\\APCu',
|
'memcache.local' => '\\OC\\Memcache\\APCu',
|
||||||
'memcache.distributed' => '\\OC\\Memcache\\APCu',
|
'memcache.distributed' => '\\OC\\Memcache\\Redis',
|
||||||
'memcache.locking' => '\\OC\\Memcache\\APCu',
|
'memcache.locking' => '\\OC\\Memcache\\Redis',
|
||||||
'allow_local_remote_servers' => true,
|
'allow_local_remote_servers' => true,
|
||||||
'trusted_domains' => ['cloud'],
|
'trusted_domains' => ['cloud'],
|
||||||
'profiling.secret' => 'haze',
|
'profiling.secret' => 'haze',
|
||||||
|
|
|
||||||
12
src/cloud.rs
12
src/cloud.rs
|
|
@ -15,7 +15,7 @@ use flate2::read::GzDecoder;
|
||||||
use futures_util::future::try_join_all;
|
use futures_util::future::try_join_all;
|
||||||
use miette::{IntoDiagnostic, Report, Result, WrapErr};
|
use miette::{IntoDiagnostic, Report, Result, WrapErr};
|
||||||
use petname::petname;
|
use petname::petname;
|
||||||
use serde_json::{Map, Value};
|
use serde_json::Value;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
|
|
@ -297,7 +297,15 @@ impl Cloud {
|
||||||
.wrap_err_with(|| format!("Failed to setup work directory {}", mapping.source))?;
|
.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(
|
nc_config["apps_paths"] = Value::Array(
|
||||||
once("apps")
|
once("apps")
|
||||||
.chain(
|
.chain(
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ use std::convert::TryFrom;
|
||||||
use std::env::home_dir;
|
use std::env::home_dir;
|
||||||
use std::fs::read_to_string;
|
use std::fs::read_to_string;
|
||||||
use std::net::IpAddr;
|
use std::net::IpAddr;
|
||||||
|
use toml::map::Map;
|
||||||
use toml::Value;
|
use toml::Value;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Default)]
|
#[derive(Debug, Deserialize, Default)]
|
||||||
|
|
@ -87,6 +88,8 @@ pub struct HazeAutoSetupConfig {
|
||||||
pub disable_apps: Vec<String>,
|
pub disable_apps: Vec<String>,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub post_setup: Vec<String>,
|
pub post_setup: Vec<String>,
|
||||||
|
#[serde(default)]
|
||||||
|
pub config: Map<String, Value>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for HazeAutoSetupConfig {
|
impl Default for HazeAutoSetupConfig {
|
||||||
|
|
@ -98,6 +101,7 @@ impl Default for HazeAutoSetupConfig {
|
||||||
enable_apps: Vec::default(),
|
enable_apps: Vec::default(),
|
||||||
disable_apps: Vec::default(),
|
disable_apps: Vec::default(),
|
||||||
post_setup: Vec::default(),
|
post_setup: Vec::default(),
|
||||||
|
config: Map::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue