mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-15 16:40:45 +02:00
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