v0.4.1 : Phase 1 complete (17/17) - dashboard TUI (#33), favoris/notes/tags (#39), profils d'environnement (#40), completions dynamiques + man pages (#41), packaging officiel + CI (#42), self-update Gitea, state v3, 212 tests
This commit is contained in:
+36
-1
@@ -38,6 +38,27 @@ pub struct Config {
|
||||
/// Per-project profiles: root, default agent, env and hooks.
|
||||
#[serde(default)]
|
||||
pub projects: BTreeMap<String, ProjectProfile>,
|
||||
/// Environment profiles: a reusable set of agent + env + args
|
||||
/// (issue #40) - 'am start <agent> --profile dev'.
|
||||
#[serde(default)]
|
||||
pub profiles: BTreeMap<String, Profile>,
|
||||
}
|
||||
|
||||
/// An environment profile: a named set of agent, env and args applied at
|
||||
/// launch time (issue #40).
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct Profile {
|
||||
/// Default agent for this profile (used by 'am start --profile dev'
|
||||
/// without an agent name).
|
||||
#[serde(default)]
|
||||
pub agent: Option<String>,
|
||||
/// Environment variables injected when launching with this profile.
|
||||
#[serde(default)]
|
||||
pub env: BTreeMap<String, String>,
|
||||
/// Extra arguments appended to the run command.
|
||||
#[serde(default)]
|
||||
pub args: Vec<String>,
|
||||
}
|
||||
|
||||
fn default_version() -> String {
|
||||
@@ -66,9 +87,13 @@ pub struct Settings {
|
||||
/// Grace period (seconds) between SIGTERM and SIGKILL; 0 = default (5).
|
||||
#[serde(default)]
|
||||
pub stop_timeout_secs: u64,
|
||||
/// GitHub repository (owner/repo) used by the self-update command.
|
||||
/// Repository (owner/repo) used by the self-update command.
|
||||
#[serde(default)]
|
||||
pub self_update_repo: Option<String>,
|
||||
/// API base URL of the release server (default: GitHub api.github.com;
|
||||
/// set to https://git.dracodev.net/api/v1 for a Gitea instance).
|
||||
#[serde(default)]
|
||||
pub self_update_base_url: Option<String>,
|
||||
/// Color theme for the output (see 'am help theme' for the list; the
|
||||
/// --theme flag overrides it).
|
||||
#[serde(default)]
|
||||
@@ -94,6 +119,10 @@ pub struct ProjectProfile {
|
||||
/// Hooks: on_start / on_stop / on_install / on_update command lines.
|
||||
#[serde(default)]
|
||||
pub hooks: BTreeMap<String, Vec<String>>,
|
||||
/// Default environment profile applied when launching the default
|
||||
/// agent (issue #40).
|
||||
#[serde(default)]
|
||||
pub profile: Option<String>,
|
||||
}
|
||||
|
||||
impl Settings {
|
||||
@@ -501,6 +530,9 @@ pub fn merge(base: &mut Config, overlay: Config) {
|
||||
if o.self_update_repo.is_some() {
|
||||
s.self_update_repo = o.self_update_repo;
|
||||
}
|
||||
if o.self_update_base_url.is_some() {
|
||||
s.self_update_base_url = o.self_update_base_url;
|
||||
}
|
||||
for (k, v) in o.hooks {
|
||||
s.hooks.insert(k, v);
|
||||
}
|
||||
@@ -520,6 +552,9 @@ pub fn merge(base: &mut Config, overlay: Config) {
|
||||
for (k, v) in overlay.projects {
|
||||
base.projects.insert(k, v);
|
||||
}
|
||||
for (k, v) in overlay.profiles {
|
||||
base.profiles.insert(k, v);
|
||||
}
|
||||
}
|
||||
|
||||
/// Validate a merged config. Returns a list of human-readable problems.
|
||||
|
||||
Reference in New Issue
Block a user