Kevin Veen-Birkenbach ce029881d0
cmp-rdbms: make vars resilient when database_type is empty
Fix a templating crash during docker-compose.yml rendering when a role sets database_type to an empty string or does not expose it (e.g., svc-prx-openresty). Previously _database_id resolved to 'svc-db-' and get_app_conf attempted to read 'docker.services..name', raising AppConfigKeyError: Application ID 'svc-db-' not found.

Changes:
- Introduce _dbtype = (database_type | d('') | trim) and build _database_id only if _dbtype is non-empty.
- Guard central DB lookups: use get_app_conf(..., strict=False, default='') and only when _dbtype is set.
- Default _database_consumer_entity_name to get_entity_name of database_application_id or fallback to application_id.
- Only resolve database_port when _dbtype is set; otherwise empty.
- Minor formatting fixes for env and URL strings.

Impact:
- Prevents failures in roles without a DB or with database_type=''.
- Keeps previous behavior intact for apps with a valid database_type (mariadb/postgres).
- Eliminates 'config_path: docker.services..name' errors while keeping compose templates stable.

https://chatgpt.com/share/689b9d11-6308-800f-b20c-2d9f18d832f1
2025-08-12 21:59:37 +02:00
..
2025-08-12 19:17:02 +02:00
2025-08-12 19:17:02 +02:00
2025-08-08 17:25:31 +02:00
2025-08-12 15:00:12 +02:00
2025-08-12 04:38:41 +02:00
2025-08-07 11:31:06 +02:00
2025-08-07 17:52:34 +02:00
2025-08-07 11:31:06 +02:00
2025-08-07 11:31:06 +02:00
2025-08-07 11:31:06 +02:00
2025-08-07 11:31:06 +02:00
2025-08-07 15:46:56 +02:00
2025-07-04 08:03:27 +02:00
2025-03-20 17:00:07 +01:00
2025-07-12 17:52:36 +02:00