apiVersion: v1
kind: ConfigMap
metadata:
  name: wordpress-custom-options
  namespace: amn
data:
  .htaccess: |
    # BEGIN WordPress
    # The directives (lines) between `BEGIN WordPress` and `END WordPress` are
    # dynamically generated, and should only be modified via WordPress filters.
    # Any changes to the directives between these markers will be overwritten.

    # END WordPress

    php_value upload_max_filesize 64M
    php_value post_max_size 64M
    php_value memory_limit 128M
    php_value max_execution_time 300
    php_value max_input_time 300
  uploads.ini: |
    file_uploads = On
    memory_limit 128M
    upload_max_filesize 64M
    post_max_size 64M
    max_execution_time 300
    max_input_time 300
  WORDPRESS_CONFIG_EXTRA: |
    define('WP_MEMORY_LIMIT', '64M');
    @ini_set( 'upload_max_size', '64M' );
    @ini_set( 'post_max_size', '64M');
    @ini_set( 'max_execution_time', '300' );
  00-configure-w3-total-cache.sh: |-
    #!/bin/bash

    # Add permissions to edit wp-config.php
    chmod +w /bitnami/wordpress/wp-config.php

    # Activate W3 Total Cache pairs
    wp plugin activate w3-total-cache
    wp total-cache fix_environment

    # Choose 'Memcached' as database and object cache method
    wp total-cache option set dbcache.engine memcached --type=string
    wp total-cache option set objectcache.engine memcached --type=string
    wp total-cache flush all
    wp total-cache option set dbcache.memcached.servers wordpress-memcached.amn.svc.cluster.local:11211 --type=string
    wp total-cache option set dbcache.enabled true --type=boolean
    wp total-cache option set objectcache.memcached.servers wordpress-memcached.amn.svc.cluster.local:11211 --type=string
    wp total-cache option set objectcache.enabled true --type=boolean
    wp total-cache flush all

    # Revoke permissions to edit wp-config.php
    chmod a-w bitnami/wordpress/wp-config.php
  my.cnf: |-
    [mysqld[]
    skip-name-resolve
    explicit_defaults_for_timestamp
    basedir=/opt/bitnami/mariadb
    plugin_dir=/opt/bitnami/mariadb/plugin
    port=3306
    socket=/opt/bitnami/mariadb/tmp/mysql.sock
    tmpdir=/opt/bitnami/mariadb/tmp
    max_allowed_packet=16M
    bind-address=0.0.0.0
    pid-file=/opt/bitnami/mariadb/tmp/mysqld.pid
    log-error=/opt/bitnami/mariadb/logs/mysqld.log
    character-set-server=UTF8
    collation-server=utf8_general_ci

    [client[]
    port=3306
    socket=/opt/bitnami/mariadb/tmp/mysql.sock
    default-character-set=UTF8
    plugin_dir=/opt/bitnami/mariadb/plugin

    [manager[]
    port=3306
    socket=/opt/bitnami/mariadb/tmp/mysql.sock
    pid-file=/opt/bitnami/mariadb/tmp/mysqld.pid
