Kevin Veen-Birkenbach 94da112736
perf(friendica): single-pass patch for DB creds + system.url; align env URL; tidy vars
- Patch local.config.php in one sed exec:
  * hostname, database, username, password
  * system.url via '#' delimiter to avoid URL slash escaping
  * Single notify: docker compose up
- env.j2:
  * FRIENDICA_URL now uses domains|get_url(application_id, WEB_PROTOCOL)
  * Simplify FRIENDICA_DEBUGGING with |lower
  * Normalize spacing for readability
- vars/main.yml:
  * Minor cleanups (comment header, spacing)
  * Consistent friendica_docker_ldap_config path construction

Why: fewer container execs ⇒ faster runs; idempotent key updates; consistent URL configuration across env and PHP config.
Risk: requires WEB_PROTOCOL and domains|get_url to be defined in inventory/vars as elsewhere in the project.

https://chatgpt.com/share/689b92af-b184-800f-9664-2450e00b29d6
2025-08-12 21:15:33 +02:00

12 lines
618 B
YAML

- name: Patch Friendica local.config.php (DB + system.url) in one pass
command: >
docker exec --user {{ friendica_user }} {{ friendica_container }}
sed -ri
-e "s/('hostname'\s*=>\s*')[^']*(',)/\1{{ database_host }}:{{ database_port }}\2/"
-e "s/('database'\s*=>\s*')[^']*(',)/\1{{ database_name }}\2/"
-e "s/('username'\s*=>\s*')[^']*(',)/\1{{ database_username }}\2/"
-e "s/('password'\s*=>\s*')[^']*(',)/\1{{ database_password }}\2/"
-e "s#('url'\s*=>\s*')[^']*(',)#\1{{ domains | get_url(application_id, WEB_PROTOCOL) }}\2#"
{{ friendica_config_file }}
notify: docker compose up