ia_dev/deploy/_lib/env-map.sh
Nicolas Cantu 61cec6f430 Sync ia_dev: token resolution via .secrets/<env>/ia_token, doc updates
**Motivations:**
- Align master with current codebase (token from projects/<id>/.secrets/<env>/ia_token)
- Id resolution by mail To or by API token; no slug

**Root causes:**
- Token moved from conf.json to .secrets/<env>/ia_token; env from directory name

**Correctifs:**
- Server and scripts resolve project+env by scanning all projects and envs

**Evolutions:**
- tickets-fetch-inbox routes by To address; notary-ai agents and API doc updated

**Pages affectées:**
- ai_working_help/server.js, docs, project_config.py, lib/project_config.sh
- projects/README.md, lecoffreio/docs/API.md, gitea-issues/tickets-fetch-inbox.py
2026-03-16 15:00:23 +01:00

67 lines
1.5 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
#
# Environment mapping for LeCoffre.io v2 deployments (proxy-based infra).
# - Proxy (jump/orchestrator): 192.168.1.100 (4nk.myftp.biz)
# - Targets: test=192.168.1.101, pprod=192.168.1.102, prod=192.168.1.103, services=192.168.1.104
#
get_env_target_ip() {
local env="$1"
case "$env" in
test) echo "192.168.1.101" ;;
pprod) echo "192.168.1.102" ;;
prod) echo "192.168.1.103" ;;
services) echo "192.168.1.104" ;;
*) return 1 ;;
esac
}
get_env_domain() {
local env="$1"
case "$env" in
test) echo "test.lecoffreio.4nkweb.com" ;;
pprod) echo "pprod.lecoffreio.4nkweb.com" ;;
prod) echo "prod.lecoffreio.4nkweb.com" ;;
*) return 1 ;;
esac
}
# Repository path on each target host (infra standard: /srv/4NK/<domain>/)
get_env_remote_app_root() {
local env="$1"
local domain
domain="$(get_env_domain "$env")"
echo "/srv/4NK/${domain}"
}
# Public service port (proxied by nginx on proxy).
# This port is reserved for LeCoffre.io in the infra ports map.
get_env_service_port() {
local env="$1"
case "$env" in
test|pprod|prod) echo "3009" ;;
*) return 1 ;;
esac
}
# Internal frontend port (served by Next.js, proxied by local router).
get_env_frontend_internal_port() {
local env="$1"
case "$env" in
test|pprod|prod) echo "3100" ;;
*) return 1 ;;
esac
}
# Internal backend port (served by Express, proxied by local router).
get_env_backend_internal_port() {
local env="$1"
case "$env" in
test|pprod|prod) echo "3101" ;;
*) return 1 ;;
esac
}