From dbecc7dcfb85c046fa5bc8eb908411588f18f700 Mon Sep 17 00:00:00 2001 From: Lukas Hirt Date: Tue, 1 Dec 2020 10:00:32 +0100 Subject: [PATCH] Add docs template --- onlyoffice/templates/CONFIGURATION.tmpl | 78 +++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 onlyoffice/templates/CONFIGURATION.tmpl diff --git a/onlyoffice/templates/CONFIGURATION.tmpl b/onlyoffice/templates/CONFIGURATION.tmpl new file mode 100644 index 000000000..9d59cc321 --- /dev/null +++ b/onlyoffice/templates/CONFIGURATION.tmpl @@ -0,0 +1,78 @@ +--- +title: "Configuration" +date: "{{ date "2006-01-02T15:04:05-0700" now }}" +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/onlyoffice/templates +geekdocFilePath: CONFIGURATION.tmpl +--- +{{- define "options"}} +{{ $fnName := (last . ).Flags -}} +{{ range $opt := first . }}{{ with list $fnName $opt -}} +{{ $o := last . -}} +{{ if eq $o.FnName $fnName -}} +--{{ $o.Name }} | ${{ index $o.Env 0 }} +: {{ $o.Usage }}. {{- if $o.Default }} Default: `{{ $o.Default }}`.{{ end }} + +{{ end -}} +{{ end -}} +{{ end -}} +{{ end }} + +{{`{{< toc >}}`}} + +## Configuration + +oCIS Single Binary is not responsible for configuring extensions. Instead, each extension could either be configured by environment variables, cli flags or config files. + +Each extension has its dedicated documentation page (e.g. https://owncloud.github.io/extensions/onlyoffice/configuration) which lists all possible configurations. Config files and environment variables are picked up if you use the `./bin/ocis server` command within the oCIS single binary. Command line flags must be set explicitly on the extensions subcommands. + +### Configuration using config files + +Out of the box extensions will attempt to read configuration details from: + +```console +/etc/ocis +$HOME/.ocis +./config +``` + +For this configuration to be picked up, have a look at your extension `root` command and look for which default config name it has assigned. *i.e: onlyoffice reads `onlyoffice.json | yaml | toml ...`*. + +So far we support the file formats `JSON` and `YAML`, if you want to get a full example configuration just take a look at [our repository](https://github.com/owncloud/ocis/tree/master/config), there you can always see the latest configuration format. These example configurations include all available options and the default values. The configuration file will be automatically loaded if it's placed at `/etc/ocis/ocis.yml`, `${HOME}/.ocis/ocis.yml` or `$(pwd)/config/ocis.yml`. + +### Environment variables + +If you prefer to configure the service with environment variables you can see the available variables below. + +### Commandline flags + +If you prefer to configure the service with commandline flags you can see the available variables below. Command line flags are only working when calling the subcommand directly. + +{{ $options := .Options -}} +{{ range $com := .Commands }}{{ with (list $options $com) -}} +{{ $c := last . -}} +{{ if eq $c.Name "onlyoffice" -}} +## Root Command + +{{ $c.Usage }} + +Usage: `onlyoffice [global options] command [command options] [arguments...]` +{{ template "options" . -}} +## Sub Commands + +{{ end -}} +{{ end -}} +{{ end -}} +{{- range $com := .Commands }}{{ with (list $options $com) -}} +{{- $c := last . }} +{{- if ne $c.Name "onlyoffice" -}} +### onlyoffice {{ $c.Name }} + +{{ $c.Usage }} + +Usage: `onlyoffice {{ $c.Name }} [command options] [arguments...]` +{{ template "options" . }} +{{- end -}} +{{- end -}} +{{- end -}}