groundhog2k / helm-charts

Helm charts for open source applications - ready to use for deployment on Kubernetes
MIT License
69 stars 56 forks source link

Support for adding custom setting to wp-config.php ? #1233

Closed MihaiMoldovanu closed 1 year ago

MihaiMoldovanu commented 1 year ago

in official wordpress image there is a setting to add custom directives to wp-config.php called WORDPRESS_CONFIG_EXTRA . It is possible to add support for it ?

MihaiMoldovanu commented 1 year ago

I have made a small modification that allows me to do just that . In secureconfig.yaml i changed to:

{{- with .Values.settings }}
  {{- if .tablePrefix }}
  WORDPRESS_TABLE_PREFIX: {{ .tablePrefix | b64enc }}
  {{- end }}
  {{- if .extra }}
  WORDPRESS_CONFIG_EXTRA: {{ .extra | b64enc }}
  {{- end }}
{{- end }}

and this allows to set it in values like this:

## Wordpress specific settings
settings:
  ## Database table name prefix
  tablePrefix:
  ## Maximum file upload size (default: 64M)
  maxFileUploadSize: 256M
  ## PHP memory limit (default: 128M)
  memoryLimit: 256M
  extra: |
    define('MY_CUSTOM_FLAG', true);
groundhog2k commented 1 year ago

Yes, that is one solution. I would like to adapt the chart and allow extra environment variables as ConfigMap and as Secret (depending on the needs). For now you also have the option to simply define an env.-variable in the chart with:

env:
  - name: WORDPRESS_CONFIG_EXTRA
    value: ...
groundhog2k commented 1 year ago

@MihaiMoldovanu : Please have a look at the PR https://github.com/groundhog2k/helm-charts/pull/1234 and give me feedback.