mirror of
https://codeberg.org/icewind/haze.git
synced 2026-06-03 09:04:12 +02:00
add options for enabling/disabling apps
This commit is contained in:
parent
44ae8ebae5
commit
036232285c
4 changed files with 44 additions and 2 deletions
|
|
@ -275,8 +275,10 @@ work_dir = "/path/to/temp/dir" # path to temporary directory. optional, defaults
|
|||
enabled = false # whether or not to automatically install nextcloud on `haze start`. enabled by default
|
||||
username = "foo" # username for admin user during auto setup. optional, defaults to "admin"
|
||||
password = "bar" # password for admin user during auto setup. optional, defaults to "admin"
|
||||
enable_apps = ["files_external"] # apps to enable after setup, defaults to []
|
||||
disable_apps = ["contacts"] # apps to disable after setup, defaults to []
|
||||
post_setup = [# commands to execute after setup, defaults to []
|
||||
"occ app:enable deck",
|
||||
"occ group:add test",
|
||||
]
|
||||
|
||||
[[volume]] # optional
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ with lib; let
|
|||
auto_setup = {
|
||||
enabled = cfg.autoSetup.enable;
|
||||
post_setup = cfg.autoSetup.postSetup;
|
||||
enable_apps = cfg.autoSetup.enableApps;
|
||||
disable_apps = cfg.autoSetup.disableApps;
|
||||
};
|
||||
volume =
|
||||
map (volume: {
|
||||
|
|
@ -64,9 +66,19 @@ in {
|
|||
options = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
default = true;
|
||||
description = "Enable auto setup";
|
||||
};
|
||||
enableApps = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
description = "Apps to enable post-setup";
|
||||
};
|
||||
disableApps = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
description = "Apps to enable post-setup";
|
||||
};
|
||||
postSetup = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
|
|
|
|||
|
|
@ -70,6 +70,10 @@ pub struct HazeAutoSetupConfig {
|
|||
#[serde(default = "default_auto_setup_password")]
|
||||
pub password: String,
|
||||
#[serde(default)]
|
||||
pub enable_apps: Vec<String>,
|
||||
#[serde(default)]
|
||||
pub disable_apps: Vec<String>,
|
||||
#[serde(default)]
|
||||
pub post_setup: Vec<String>,
|
||||
}
|
||||
|
||||
|
|
@ -79,6 +83,8 @@ impl Default for HazeAutoSetupConfig {
|
|||
enabled: false,
|
||||
username: default_auto_setup_username(),
|
||||
password: default_auto_setup_password(),
|
||||
enable_apps: Vec::default(),
|
||||
disable_apps: Vec::default(),
|
||||
post_setup: Vec::default(),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
22
src/main.rs
22
src/main.rs
|
|
@ -560,6 +560,28 @@ async fn setup(docker: &Docker, options: CloudOptions, config: &HazeConfig) -> R
|
|||
.await?;
|
||||
}
|
||||
|
||||
for app in &config.auto_setup.enable_apps {
|
||||
cloud
|
||||
.exec(
|
||||
docker,
|
||||
vec!["occ", "app:enable", app.as_str(), "--force"],
|
||||
false,
|
||||
Vec::<String>::default(),
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
|
||||
for app in &config.auto_setup.disable_apps {
|
||||
cloud
|
||||
.exec(
|
||||
docker,
|
||||
vec!["occ", "app:disable", app.as_str()],
|
||||
false,
|
||||
Vec::<String>::default(),
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
|
||||
for service in cloud.services() {
|
||||
for app in service.apps() {
|
||||
cloud
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue