Skip to content
Snippets Groups Projects
onlyoffice-config.yaml 3.16 KiB
Newer Older
{{- $onlyoffice := index .Values "onlyoffice-documentserver" }}
apiVersion: v1
kind: ConfigMap
metadata:
  name: "{{ .Release.Name }}-onlyoffice-config"
  labels:
    app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
    app.kubernetes.io/instance: {{ .Release.Name | quote }}
    helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
data:
  onlyoffice-config.json: |
    {
      "apps": {
        "onlyoffice": {
          "DocumentServerInternalUrl": "",
          "DocumentServerUrl": "https:\/\/{{ $onlyoffice.onlyoffice.server_name }}\/",
          "StorageUrl": "https:\/\/{{ .Values.nextcloud.nextcloud.host }}\/",
          "defFormats": "{\"csv\":\"false\",\"doc\":\"false\",\"docm\":\"false\",\"docx\":\"true\",\"dotx\":\"false\",\"epub\":\"false\",\"html\":\"false\",\"odp\":\"true\",\"ods\":\"true\",\"odt\":\"true\",\"pdf\":\"false\",\"potm\":\"false\",\"potx\":\"false\",\"ppsm\":\"false\",\"ppsx\":\"false\",\"ppt\":\"false\",\"pptm\":\"false\",\"pptx\":\"true\",\"rtf\":\"false\",\"txt\":\"false\",\"xls\":\"false\",\"xlsm\":\"false\",\"xlsx\":\"true\",\"xltm\":\"false\",\"xltx\":\"false\"}",
          "editFormats": "{\"csv\":\"true\",\"odp\":\"true\",\"ods\":\"true\",\"odt\":\"true\",\"rtf\":\"false\",\"txt\":\"true\"}",
          "enabled": "yes",
          "groups": "[]",
          "jwt_secret": "{{ $onlyoffice.jwtSecret }}",
          "sameTab": "false",
          "settings_error": "",
          "types": "filesystem"
        }
      }
    }
    #!/bin/bash

    set -ev
    # Debug: place the json file in a persistent location for reuse
    cp /var/local/onlyoffice-config.json /var/www/html/
    {{- range .Values.apps }}
    # -- Begin {{ .name }}
    # Only install {{ .name }} if it's not installed already
    if ! php occ app:list | grep -q {{ .name }}; then
        php occ app:install {{ .name }} --keep-disabled --no-interaction
    php occ app:enable {{ .name }}
    {{ end }} # -- end {{ .name }}
    {{ end }} # end range {{ .Values.apps }}

    # Config settings from the configmap above
    php occ config:import /var/local/onlyoffice-config.json
  #
  # All values in config.json are applied by the nextcloud occ command
  #   config:import.
  # system.trusted_proxies contains a list of proxies that are considered
  #   to be trusted. 10.43.0.0/16 contains all ip addresses that are
  #   assigned to kubernetes services which includes the ip address of
  #   the ingress service that functions as a proxy.
  # system.overwriteprotocol overwrites the protocol of links that are
  #   generated by nextcloud to HTTPS.
  # apps.core.backgroundjobs_mode set to cron disables the unreliable ajax
  #   scheduling that is enabled by default. Ajax scheduling is not needed
  #   because cronjobs are regularly executed by a kubernetes resource.
  #
Mark's avatar
Mark committed
  config.json: |
    {
        "system":{
            "trusted_proxies": "10.43.0.0/16",
            "overwriteprotocol": "https",
            "appstoreenabled": false,
            "debug": {{ .Values.nextcloud.debug | quote }}
Mark's avatar
Mark committed
        },
        "apps":{
            "core":{
                "backgroundjobs_mode": "cron"
            }
        }
    }