diff --git a/roles/web-app-friendica/tasks/02_patch_config.yml b/roles/web-app-friendica/tasks/02_patch_config.yml index 07418216..9e173002 100644 --- a/roles/web-app-friendica/tasks/02_patch_config.yml +++ b/roles/web-app-friendica/tasks/02_patch_config.yml @@ -1,23 +1,11 @@ -- name: Update DB host +- name: Patch Friendica local.config.php (DB + system.url) in one pass command: > docker exec --user {{ friendica_user }} {{ friendica_container }} - sed -ri "s/('hostname'\s*=>\s*')[^']*(',)/\1{{ database_host }}:{{ database_port }}\2/" {{ friendica_config_file }} - notify: docker compose up - -- name: Update DB name - command: > - docker exec --user {{ friendica_user }} {{ friendica_container }} - sed -ri "s/('database'\s*=>\s*')[^']*(',)/\1{{ database_name }}\2/" {{ friendica_config_file }} - notify: docker compose up - -- name: Update DB user - command: > - docker exec --user {{ friendica_user }} {{ friendica_container }} - sed -ri "s/('username'\s*=>\s*')[^']*(',)/\1{{ database_username }}\2/" {{ friendica_config_file }} - notify: docker compose up - -- name: Update DB password - command: > - docker exec --user {{ friendica_user }} {{ friendica_container }} - sed -ri "s/('password'\s*=>\s*')[^']*(',)/\1{{ database_password }}\2/" {{ friendica_config_file }} + 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 diff --git a/roles/web-app-friendica/templates/env.j2 b/roles/web-app-friendica/templates/env.j2 index 04f6bd68..7d8da58d 100644 --- a/roles/web-app-friendica/templates/env.j2 +++ b/roles/web-app-friendica/templates/env.j2 @@ -1,25 +1,25 @@ # The configuration options can be found here: # @see https://hub.docker.com/_/friendica -FRIENDICA_URL=https://{{domains | get_domain(application_id)}} +FRIENDICA_URL={{ domains | get_url(application_id, WEB_PROTOCOL) }} HOSTNAME={{domains | get_domain(application_id)}} FRIENDICA_NO_VALIDATION={{friendica_no_validation | lower}} - + # Debugging -FRIENDICA_DEBUGGING={% if enable_debug | bool %}true{% else %}false{% endif %}{{"\n"}} +FRIENDICA_DEBUGGING={{ (enable_debug | bool) | lower }}{{"\n"}} FRIENDICA_LOGLEVEL={% if enable_debug | bool %}9{% else %}5{% endif %}{{"\n"}} FRIENDICA_LOGGER=syslog # Database Configuration -MYSQL_HOST= "{{database_host}}:{{database_port}}" -MYSQL_DATABASE= {{database_name}} -MYSQL_USER= {{database_username}} -MYSQL_PASSWORD= {{database_password}} +MYSQL_HOST= "{{ database_host }}:{{ database_port }}" +MYSQL_DATABASE= {{ database_name }} +MYSQL_USER= {{ database_username }} +MYSQL_PASSWORD= {{ database_password }} # Email Configuration -SMTP= {{system_email.host}} -SMTP_DOMAIN= {{system_email.domain}} -SMTP_PORT= {{system_email.port}} +SMTP= {{ system_email.host }} +SMTP_DOMAIN= {{ system_email.domain }} +SMTP_PORT= {{ system_email.port }} SMTP_AUTH_USER= {{ users['no-reply'].email }} SMTP_AUTH_PASS= {{ users['no-reply'].mailu_token }} SMTP_TLS= {{ 'on' if system_email.tls else 'off' }} diff --git a/roles/web-app-friendica/vars/main.yml b/roles/web-app-friendica/vars/main.yml index 3f3959e4..dee439f9 100644 --- a/roles/web-app-friendica/vars/main.yml +++ b/roles/web-app-friendica/vars/main.yml @@ -5,11 +5,11 @@ database_type: "mariadb" # Docker docker_compose_flush_handlers: false -# Friendica Specific +# Friendica friendica_container: "friendica" friendica_no_validation: "{{ applications | get_app_conf(application_id, 'features.oidc', True) }}" # Email validation is not neccessary if OIDC is active friendica_application_base: "/var/www/html" -friendica_docker_ldap_config: "{{friendica_application_base}}/config/ldapauth.config.php" +friendica_docker_ldap_config: "{{ friendica_application_base }}/config/ldapauth.config.php" friendica_host_ldap_config: "{{ docker_compose.directories.volumes }}ldapauth.config.php" friendica_config_dir: "{{ friendica_application_base }}/config" friendica_config_file: "{{ friendica_config_dir }}/local.config.php"