ia_dev/deploy/lib/deploy-conf-handling.sh
Nicolas Cantu d80b240853 refactor(deploy): hoist shared conf handling to deploy/lib
**Motivations:**
- Apply approved boundary: identical steps in ia_dev libs; project orchestrator keeps only specific sequencing

**Root causes:**
- N/A

**Correctifs:**
- N/A

**Evolutions:**
- Add deploy/lib/deploy-conf-handling.sh (jq, secrets_path export, IA_DEV_DEPLOY_* context)
- Document boundary in deploy-methodology.sh; orchestrator sources new lib
- deploy/lib/README.md: boundary + deploy-conf-handling

**Pages affectées:**
- deploy/lib/*.sh, deploy/orchestrator.sh, deploy/lib/README.md
2026-03-23 13:23:23 +01:00

33 lines
1.3 KiB
Bash

#!/usr/bin/env bash
# ia_dev — conf.json handling identical for every managed project (jq, secrets_path → SECRETS_BASE).
# Add here any new deploy.* field that must be read the same way for all projects.
# Do not put project-specific paths, hostnames, or phase ordering here beyond generic keys.
# ia_dev_deploy_require_jq <log_tag> — exit 1 if jq missing (e.g. log_tag="[orchestrator]")
ia_dev_deploy_require_jq() {
local tag="${1:-[ia_dev][deploy]}"
if ! command -v jq >/dev/null 2>&1; then
echo "${tag}[ERROR] jq is required to read deploy.* from conf.json" >&2
exit 1
fi
}
# ia_dev_deploy_secrets_export_from_conf <conf_path> — export SECRETS_BASE + LECOFFRE_SECRETS_BASE when deploy.secrets_path is a directory
ia_dev_deploy_secrets_export_from_conf() {
local conf="${1:?}"
local secrets_path
secrets_path="$(jq -r '.deploy.secrets_path // empty' "$conf")"
if [[ -n "$secrets_path" && "$secrets_path" != "null" && -d "$secrets_path" ]]; then
export SECRETS_BASE="$secrets_path"
export LECOFFRE_SECRETS_BASE="$secrets_path"
fi
}
# ia_dev_deploy_export_runtime_context <repository_root> <env> — optional hints for project orchestrator scripts
ia_dev_deploy_export_runtime_context() {
local repo="${1:?}"
local env="${2:?}"
export IA_DEV_DEPLOY_REPO_ROOT="$repo"
export IA_DEV_DEPLOY_ENV="$env"
}