mirror of
https://codeberg.org/icewind/haze.git
synced 2026-06-03 17:14:08 +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
|
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"
|
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"
|
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 []
|
post_setup = [# commands to execute after setup, defaults to []
|
||||||
"occ app:enable deck",
|
"occ group:add test",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[volume]] # optional
|
[[volume]] # optional
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,8 @@ with lib; let
|
||||||
auto_setup = {
|
auto_setup = {
|
||||||
enabled = cfg.autoSetup.enable;
|
enabled = cfg.autoSetup.enable;
|
||||||
post_setup = cfg.autoSetup.postSetup;
|
post_setup = cfg.autoSetup.postSetup;
|
||||||
|
enable_apps = cfg.autoSetup.enableApps;
|
||||||
|
disable_apps = cfg.autoSetup.disableApps;
|
||||||
};
|
};
|
||||||
volume =
|
volume =
|
||||||
map (volume: {
|
map (volume: {
|
||||||
|
|
@ -64,9 +66,19 @@ in {
|
||||||
options = {
|
options = {
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = true;
|
||||||
description = "Enable auto setup";
|
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 {
|
postSetup = mkOption {
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
default = [];
|
default = [];
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,10 @@ pub struct HazeAutoSetupConfig {
|
||||||
#[serde(default = "default_auto_setup_password")]
|
#[serde(default = "default_auto_setup_password")]
|
||||||
pub password: String,
|
pub password: String,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
|
pub enable_apps: Vec<String>,
|
||||||
|
#[serde(default)]
|
||||||
|
pub disable_apps: Vec<String>,
|
||||||
|
#[serde(default)]
|
||||||
pub post_setup: Vec<String>,
|
pub post_setup: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -79,6 +83,8 @@ impl Default for HazeAutoSetupConfig {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
username: default_auto_setup_username(),
|
username: default_auto_setup_username(),
|
||||||
password: default_auto_setup_password(),
|
password: default_auto_setup_password(),
|
||||||
|
enable_apps: Vec::default(),
|
||||||
|
disable_apps: Vec::default(),
|
||||||
post_setup: 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?;
|
.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 service in cloud.services() {
|
||||||
for app in service.apps() {
|
for app in service.apps() {
|
||||||
cloud
|
cloud
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue