diff --git a/.drone.star b/.drone.star index ee45183af..7ac4513fe 100644 --- a/.drone.star +++ b/.drone.star @@ -1260,7 +1260,7 @@ def docs(ctx): { "name": "docs-generate", "image": OC_CI_GOLANG, - "commands": ["make -C %s docs-generate" % (module) for module in config["modules"]], + "commands": ["make -C docs docs-generate"], }, { "name": "prepare", diff --git a/accounts/pkg/config/config.go b/accounts/pkg/config/config.go index 79024993b..9a4609d7e 100644 --- a/accounts/pkg/config/config.go +++ b/accounts/pkg/config/config.go @@ -25,45 +25,45 @@ type Config struct { Repo Repo `ocisConfig:"repo"` Index Index `ocisConfig:"index"` ServiceUser ServiceUser `ocisConfig:"service_user"` - HashDifficulty int `ocisConfig:"hash_difficulty" env:"ACCOUNTS_HASH_DIFFICULTY"` - DemoUsersAndGroups bool `ocisConfig:"demo_users_and_groups" env:"ACCOUNTS_DEMO_USERS_AND_GROUPS"` + HashDifficulty int `ocisConfig:"hash_difficulty" env:"ACCOUNTS_HASH_DIFFICULTY" desc:"The hash difficulty makes sure that validating a password takes at least a certain amount of time."` + DemoUsersAndGroups bool `ocisConfig:"demo_users_and_groups" env:"ACCOUNTS_DEMO_USERS_AND_GROUPS" desc:"If this flag is set the service will setup the demo users and groups."` Context context.Context } // Asset defines the available asset configuration. type Asset struct { - Path string `ocisConfig:"path" env:"ACCOUNTS_ASSET_PATH"` + Path string `ocisConfig:"path" env:"ACCOUNTS_ASSET_PATH" desc:"The path to the ui assets."` } // TokenManager is the config for using the reva token manager type TokenManager struct { - JWTSecret string `ocisConfig:"jwt_secret" env:"OCIS_JWT_SECRET;ACCOUNTS_JWT_SECRET"` + JWTSecret string `ocisConfig:"jwt_secret" env:"OCIS_JWT_SECRET;ACCOUNTS_JWT_SECRET" desc:"The secret to mint jwt tokens."` } // Repo defines which storage implementation is to be used. type Repo struct { - Backend string `ocisConfig:"backend" env:"ACCOUNTS_STORAGE_BACKEND"` + Backend string `ocisConfig:"backend" env:"ACCOUNTS_STORAGE_BACKEND" desc:"Defines which storage implementation is to be used"` Disk Disk `ocisConfig:"disk"` CS3 CS3 `ocisConfig:"cs3"` } // Disk is the local disk implementation of the storage. type Disk struct { - Path string `ocisConfig:"path" env:"ACCOUNTS_STORAGE_DISK_PATH"` + Path string `ocisConfig:"path" env:"ACCOUNTS_STORAGE_DISK_PATH" desc:"The path where the accounts data is stored."` } // CS3 is the cs3 implementation of the storage. type CS3 struct { - ProviderAddr string `ocisConfig:"provider_addr" env:"ACCOUNTS_STORAGE_CS3_PROVIDER_ADDR"` + ProviderAddr string `ocisConfig:"provider_addr" env:"ACCOUNTS_STORAGE_CS3_PROVIDER_ADDR" desc:"The address to the storage provider."` } // ServiceUser defines the user required for EOS. type ServiceUser struct { - UUID string `ocisConfig:"uuid" env:"ACCOUNTS_SERVICE_USER_UUID"` - Username string `ocisConfig:"username" env:"ACCOUNTS_SERVICE_USER_USERNAME"` - UID int64 `ocisConfig:"uid" env:"ACCOUNTS_SERVICE_USER_UID"` - GID int64 `ocisConfig:"gid" env:"ACCOUNTS_SERVICE_USER_GID"` + UUID string `ocisConfig:"uuid" env:"ACCOUNTS_SERVICE_USER_UUID" desc:"The id of the accounts service user."` + Username string `ocisConfig:"username" env:"ACCOUNTS_SERVICE_USER_USERNAME" desc:"The username of the accounts service user."` + UID int64 `ocisConfig:"uid" env:"ACCOUNTS_SERVICE_USER_UID" desc:"The uid of the accounts service user."` + GID int64 `ocisConfig:"gid" env:"ACCOUNTS_SERVICE_USER_GID" desc:"The gid of the accounts service user."` } // Index defines config for indexes. @@ -74,12 +74,12 @@ type Index struct { // GIDBound defines a lower and upper bound. type GIDBound struct { - Lower int64 `ocisConfig:"lower" env:"ACCOUNTS_GID_INDEX_LOWER_BOUND"` - Upper int64 `ocisConfig:"upper" env:"ACCOUNTS_GID_INDEX_UPPER_BOUND"` + Lower int64 `ocisConfig:"lower" env:"ACCOUNTS_GID_INDEX_LOWER_BOUND" desc:"The lowest possible gid value for the indexer."` + Upper int64 `ocisConfig:"upper" env:"ACCOUNTS_GID_INDEX_UPPER_BOUND" desc:"The highest possible gid value for the indexer."` } // UIDBound defines a lower and upper bound. type UIDBound struct { - Lower int64 `ocisConfig:"lower" env:"ACCOUNTS_UID_INDEX_LOWER_BOUND"` - Upper int64 `ocisConfig:"upper" env:"ACCOUNTS_UID_INDEX_UPPER_BOUND"` + Lower int64 `ocisConfig:"lower" env:"ACCOUNTS_UID_INDEX_LOWER_BOUND" desc:"The lowest possible uid value for the indexer."` + Upper int64 `ocisConfig:"upper" env:"ACCOUNTS_UID_INDEX_UPPER_BOUND" desc:"The highest possible uid value for the indexer."` } diff --git a/accounts/pkg/config/grpc.go b/accounts/pkg/config/grpc.go index f16de42f2..a89e0ca00 100644 --- a/accounts/pkg/config/grpc.go +++ b/accounts/pkg/config/grpc.go @@ -2,6 +2,6 @@ package config // GRPC defines the available grpc configuration. type GRPC struct { - Addr string `ocisConfig:"addr" env:"ACCOUNTS_GRPC_ADDR"` + Addr string `ocisConfig:"addr" env:"ACCOUNTS_GRPC_ADDR" desc:"The address of the grpc service."` Namespace string } diff --git a/accounts/pkg/config/http.go b/accounts/pkg/config/http.go index c8c7ab628..6a8828ea9 100644 --- a/accounts/pkg/config/http.go +++ b/accounts/pkg/config/http.go @@ -2,11 +2,11 @@ package config // HTTP defines the available http configuration. type HTTP struct { - Addr string `ocisConfig:"addr" env:"ACCOUNTS_HTTP_ADDR"` + Addr string `ocisConfig:"addr" env:"ACCOUNTS_HTTP_ADDR" desc:"The address of the http service."` Namespace string - Root string `ocisConfig:"root" env:"ACCOUNTS_HTTP_ROOT"` - CacheTTL int `ocisConfig:"cache_ttl" env:"ACCOUNTS_CACHE_TTL"` - CORS CORS `ocisConfig:"cors"` + Root string `ocisConfig:"root" env:"ACCOUNTS_HTTP_ROOT" desc:"The root path of the http service."` + CacheTTL int `ocisConfig:"cache_ttl" env:"ACCOUNTS_CACHE_TTL" desc:"The cache time for the static assets."` + CORS CORS } // CORS defines the available cors configuration. diff --git a/accounts/pkg/config/log.go b/accounts/pkg/config/log.go index 6ada8a7dd..f9548ed77 100644 --- a/accounts/pkg/config/log.go +++ b/accounts/pkg/config/log.go @@ -2,8 +2,8 @@ package config // Log defines the available log configuration. type Log struct { - Level string `mapstructure:"level" env:"OCIS_LOG_LEVEL;ACCOUNTS_LOG_LEVEL"` - Pretty bool `mapstructure:"pretty" env:"OCIS_LOG_PRETTY;ACCOUNTS_LOG_PRETTY"` - Color bool `mapstructure:"color" env:"OCIS_LOG_COLOR;ACCOUNTS_LOG_COLOR"` - File string `mapstructure:"file" env:"OCIS_LOG_FILE;ACCOUNTS_LOG_FILE"` + Level string `ocisConfig:"level" env:"OCIS_LOG_LEVEL;ACCOUNTS_LOG_LEVEL" desc:"The log level."` + Pretty bool `ocisConfig:"pretty" env:"OCIS_LOG_PRETTY;ACCOUNTS_LOG_PRETTY" desc:"Activates pretty log output."` + Color bool `ocisConfig:"color" env:"OCIS_LOG_COLOR;ACCOUNTS_LOG_COLOR" desc:"Activates colorized log output."` + File string `ocisConfig:"file" env:"OCIS_LOG_FILE;ACCOUNTS_LOG_FILE" desc:"The target log file."` } diff --git a/accounts/pkg/config/tracing.go b/accounts/pkg/config/tracing.go index fc673f824..4bd0c7924 100644 --- a/accounts/pkg/config/tracing.go +++ b/accounts/pkg/config/tracing.go @@ -2,8 +2,8 @@ package config // Tracing defines the available tracing configuration. type Tracing struct { - Enabled bool `ocisConfig:"enabled" env:"OCIS_TRACING_ENABLED;ACCOUNTS_TRACING_ENABLED"` + Enabled bool `ocisConfig:"enabled" env:"OCIS_TRACING_ENABLED;ACCOUNTS_TRACING_ENABLED" desc:"Activates tracing."` Type string `ocisConfig:"type" env:"OCIS_TRACING_TYPE;ACCOUNTS_TRACING_TYPE"` - Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;ACCOUNTS_TRACING_ENDPOINT"` + Endpoint string `ocisConfig:"endpoint" env:"OCIS_TRACING_ENDPOINT;ACCOUNTS_TRACING_ENDPOINT" desc:"The endpoint to the tracing collector."` Collector string `ocisConfig:"collector" env:"OCIS_TRACING_COLLECTOR;ACCOUNTS_TRACING_COLLECTOR"` } diff --git a/docs/Makefile b/docs/Makefile index 66ec7e7b9..12121bd84 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -8,6 +8,7 @@ help: .PHONY: docs-generate docs-generate: ## run docs-generate for all oCIS extensions + @pushd helpers && go run configenvextractor.go; popd @$(MAKE) --no-print-directory -C ../ docs-generate .PHONY: docs-init diff --git a/docs/extensions/_includes/.gitignore b/docs/extensions/_includes/.gitignore new file mode 100644 index 000000000..a463a88c5 --- /dev/null +++ b/docs/extensions/_includes/.gitignore @@ -0,0 +1 @@ +*_configvars.md diff --git a/docs/extensions/_includes/_index.md b/docs/extensions/_includes/_index.md new file mode 100644 index 000000000..b58ce0c82 --- /dev/null +++ b/docs/extensions/_includes/_index.md @@ -0,0 +1,3 @@ +--- +GeekdocHidden: true +--- \ No newline at end of file diff --git a/docs/extensions/accounts/.gitignore b/docs/extensions/accounts/.gitignore index 582a0f847..63536ebfa 100644 --- a/docs/extensions/accounts/.gitignore +++ b/docs/extensions/accounts/.gitignore @@ -1,2 +1 @@ -configuration.md grpc.md diff --git a/docs/extensions/accounts/configuration.md b/docs/extensions/accounts/configuration.md new file mode 100644 index 000000000..584b5b183 --- /dev/null +++ b/docs/extensions/accounts/configuration.md @@ -0,0 +1,12 @@ +--- +title: Service Configuration +date: 2018-05-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/accounts +geekdocFilePath: configuration.md +geekdocCollapseSection: true +--- + + +{{< include file="extensions/_includes/accounts_configvars.md" >}} \ No newline at end of file diff --git a/docs/extensions/glauth/.gitignore b/docs/extensions/glauth/.gitignore index 582a0f847..63536ebfa 100644 --- a/docs/extensions/glauth/.gitignore +++ b/docs/extensions/glauth/.gitignore @@ -1,2 +1 @@ -configuration.md grpc.md diff --git a/docs/extensions/glauth/configuration.md b/docs/extensions/glauth/configuration.md new file mode 100644 index 000000000..7132fe0e5 --- /dev/null +++ b/docs/extensions/glauth/configuration.md @@ -0,0 +1,12 @@ +--- +title: Service Configuration +date: 2018-05-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/glauth +geekdocFilePath: configuration.md +geekdocCollapseSection: true +--- + + +{{< include file="extensions/_includes/glauth_configvars.md" >}} \ No newline at end of file diff --git a/docs/extensions/graph-explorer/.gitignore b/docs/extensions/graph-explorer/.gitignore index b0c8840e2..e69de29bb 100644 --- a/docs/extensions/graph-explorer/.gitignore +++ b/docs/extensions/graph-explorer/.gitignore @@ -1 +0,0 @@ -configuration.md diff --git a/docs/extensions/graph-explorer/configuration.md b/docs/extensions/graph-explorer/configuration.md new file mode 100644 index 000000000..c27fe2467 --- /dev/null +++ b/docs/extensions/graph-explorer/configuration.md @@ -0,0 +1,12 @@ +--- +title: Service Configuration +date: 2018-05-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/graph-explorer +geekdocFilePath: configuration.md +geekdocCollapseSection: true +--- + + +{{< include file="extensions/_includes/graph-explorer_configvars.md" >}} \ No newline at end of file diff --git a/docs/extensions/graph/.gitignore b/docs/extensions/graph/.gitignore index b0c8840e2..e69de29bb 100644 --- a/docs/extensions/graph/.gitignore +++ b/docs/extensions/graph/.gitignore @@ -1 +0,0 @@ -configuration.md diff --git a/docs/extensions/graph/configuration.md b/docs/extensions/graph/configuration.md new file mode 100644 index 000000000..786dfb133 --- /dev/null +++ b/docs/extensions/graph/configuration.md @@ -0,0 +1,12 @@ +--- +title: Service Configuration +date: 2018-05-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/graph +geekdocFilePath: configuration.md +geekdocCollapseSection: true +--- + + +{{< include file="extensions/_includes/graph_configvars.md" >}} \ No newline at end of file diff --git a/docs/extensions/idm/_index.md b/docs/extensions/idm/_index.md new file mode 100644 index 000000000..19306118e --- /dev/null +++ b/docs/extensions/idm/_index.md @@ -0,0 +1,16 @@ +--- +title: IDM +date: 2022-03-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/idm +geekdocFilePath: _index.md +geekdocCollapseSection: true +--- + +## Abstract + + +## Table of Contents + +{{< toc-tree >}} diff --git a/docs/extensions/idm/configuration.md b/docs/extensions/idm/configuration.md new file mode 100644 index 000000000..14200bcde --- /dev/null +++ b/docs/extensions/idm/configuration.md @@ -0,0 +1,12 @@ +--- +title: Service Configuration +date: 2018-05-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/idm +geekdocFilePath: configuration.md +geekdocCollapseSection: true +--- + + +{{< include file="extensions/_includes/idm_configvars.md" >}} \ No newline at end of file diff --git a/docs/extensions/idp/.gitignore b/docs/extensions/idp/.gitignore index 582a0f847..63536ebfa 100644 --- a/docs/extensions/idp/.gitignore +++ b/docs/extensions/idp/.gitignore @@ -1,2 +1 @@ -configuration.md grpc.md diff --git a/docs/extensions/idp/configuration.md b/docs/extensions/idp/configuration.md new file mode 100644 index 000000000..bc6011eac --- /dev/null +++ b/docs/extensions/idp/configuration.md @@ -0,0 +1,12 @@ +--- +title: Service Configuration +date: 2018-05-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/idp +geekdocFilePath: configuration.md +geekdocCollapseSection: true +--- + + +{{< include file="extensions/_includes/idp_configvars.md" >}} \ No newline at end of file diff --git a/docs/extensions/nats/_index.md b/docs/extensions/nats/_index.md new file mode 100644 index 000000000..bd785e222 --- /dev/null +++ b/docs/extensions/nats/_index.md @@ -0,0 +1,16 @@ +--- +title: NATS +date: 2022-03-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/nats +geekdocFilePath: _index.md +geekdocCollapseSection: true +--- + +## Abstract + + +## Table of Contents + +{{< toc-tree >}} \ No newline at end of file diff --git a/docs/extensions/nats/configuration.md b/docs/extensions/nats/configuration.md new file mode 100644 index 000000000..20ba82f34 --- /dev/null +++ b/docs/extensions/nats/configuration.md @@ -0,0 +1,12 @@ +--- +title: Service Configuration +date: 2018-05-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/nats +geekdocFilePath: configuration.md +geekdocCollapseSection: true +--- + + +{{< include file="extensions/_includes/nats_configvars.md" >}} \ No newline at end of file diff --git a/docs/extensions/notifications/_index.md b/docs/extensions/notifications/_index.md new file mode 100644 index 000000000..c0ad0f7a5 --- /dev/null +++ b/docs/extensions/notifications/_index.md @@ -0,0 +1,16 @@ +--- +title: Notifications +date: 2022-03-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/notifications +geekdocFilePath: _index.md +geekdocCollapseSection: true +--- + +## Abstract + + +## Table of Contents + +{{< toc-tree >}} \ No newline at end of file diff --git a/docs/extensions/notifications/configuration.md b/docs/extensions/notifications/configuration.md new file mode 100644 index 000000000..7da0ba47b --- /dev/null +++ b/docs/extensions/notifications/configuration.md @@ -0,0 +1,12 @@ +--- +title: Service Configuration +date: 2018-05-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/notifications +geekdocFilePath: configuration.md +geekdocCollapseSection: true +--- + + +{{< include file="extensions/_includes/notifications_configvars.md" >}} \ No newline at end of file diff --git a/docs/extensions/ocs/.gitignore b/docs/extensions/ocs/.gitignore index 582a0f847..63536ebfa 100644 --- a/docs/extensions/ocs/.gitignore +++ b/docs/extensions/ocs/.gitignore @@ -1,2 +1 @@ -configuration.md grpc.md diff --git a/docs/extensions/ocs/configuration.md b/docs/extensions/ocs/configuration.md new file mode 100644 index 000000000..502fead64 --- /dev/null +++ b/docs/extensions/ocs/configuration.md @@ -0,0 +1,12 @@ +--- +title: Service Configuration +date: 2018-05-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/ocs +geekdocFilePath: configuration.md +geekdocCollapseSection: true +--- + + +{{< include file="extensions/_includes/ocs_configvars.md" >}} \ No newline at end of file diff --git a/docs/extensions/proxy/.gitignore b/docs/extensions/proxy/.gitignore index 582a0f847..63536ebfa 100644 --- a/docs/extensions/proxy/.gitignore +++ b/docs/extensions/proxy/.gitignore @@ -1,2 +1 @@ -configuration.md grpc.md diff --git a/docs/extensions/proxy/configuration.md b/docs/extensions/proxy/configuration.md new file mode 100644 index 000000000..785922489 --- /dev/null +++ b/docs/extensions/proxy/configuration.md @@ -0,0 +1,12 @@ +--- +title: Service Configuration +date: 2018-05-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/proxy +geekdocFilePath: configuration.md +geekdocCollapseSection: true +--- + + +{{< include file="extensions/_includes/proxy_configvars.md" >}} \ No newline at end of file diff --git a/docs/extensions/settings/.gitignore b/docs/extensions/settings/.gitignore index 582a0f847..63536ebfa 100644 --- a/docs/extensions/settings/.gitignore +++ b/docs/extensions/settings/.gitignore @@ -1,2 +1 @@ -configuration.md grpc.md diff --git a/docs/extensions/settings/configuration.md b/docs/extensions/settings/configuration.md new file mode 100644 index 000000000..b20e913a7 --- /dev/null +++ b/docs/extensions/settings/configuration.md @@ -0,0 +1,12 @@ +--- +title: Service Configuration +date: 2018-05-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/settings +geekdocFilePath: configuration.md +geekdocCollapseSection: true +--- + + +{{< include file="extensions/_includes/settings_configvars.md" >}} \ No newline at end of file diff --git a/docs/extensions/storage/.gitignore b/docs/extensions/storage/.gitignore index 582a0f847..63536ebfa 100644 --- a/docs/extensions/storage/.gitignore +++ b/docs/extensions/storage/.gitignore @@ -1,2 +1 @@ -configuration.md grpc.md diff --git a/docs/extensions/store/.gitignore b/docs/extensions/store/.gitignore index 582a0f847..63536ebfa 100644 --- a/docs/extensions/store/.gitignore +++ b/docs/extensions/store/.gitignore @@ -1,2 +1 @@ -configuration.md grpc.md diff --git a/docs/extensions/store/configuration.md b/docs/extensions/store/configuration.md new file mode 100644 index 000000000..a974e254a --- /dev/null +++ b/docs/extensions/store/configuration.md @@ -0,0 +1,12 @@ +--- +title: Service Configuration +date: 2018-05-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/store +geekdocFilePath: configuration.md +geekdocCollapseSection: true +--- + + +{{< include file="extensions/_includes/store_configvars.md" >}} \ No newline at end of file diff --git a/docs/extensions/thumbnails/.gitignore b/docs/extensions/thumbnails/.gitignore index 582a0f847..63536ebfa 100644 --- a/docs/extensions/thumbnails/.gitignore +++ b/docs/extensions/thumbnails/.gitignore @@ -1,2 +1 @@ -configuration.md grpc.md diff --git a/docs/extensions/thumbnails/configuration.md b/docs/extensions/thumbnails/configuration.md new file mode 100644 index 000000000..7b6e85bde --- /dev/null +++ b/docs/extensions/thumbnails/configuration.md @@ -0,0 +1,12 @@ +--- +title: Service Configuration +date: 2018-05-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/thumbnails +geekdocFilePath: configuration.md +geekdocCollapseSection: true +--- + + +{{< include file="extensions/_includes/thumbnails_configvars.md" >}} \ No newline at end of file diff --git a/docs/extensions/web/.gitignore b/docs/extensions/web/.gitignore index 582a0f847..63536ebfa 100644 --- a/docs/extensions/web/.gitignore +++ b/docs/extensions/web/.gitignore @@ -1,2 +1 @@ -configuration.md grpc.md diff --git a/docs/extensions/web/configuration.md b/docs/extensions/web/configuration.md new file mode 100644 index 000000000..d55237fd9 --- /dev/null +++ b/docs/extensions/web/configuration.md @@ -0,0 +1,12 @@ +--- +title: Service Configuration +date: 2018-05-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/web +geekdocFilePath: configuration.md +geekdocCollapseSection: true +--- + + +{{< include file="extensions/_includes/web_configvars.md" >}} \ No newline at end of file diff --git a/docs/extensions/webdav/.gitignore b/docs/extensions/webdav/.gitignore index 582a0f847..63536ebfa 100644 --- a/docs/extensions/webdav/.gitignore +++ b/docs/extensions/webdav/.gitignore @@ -1,2 +1 @@ -configuration.md grpc.md diff --git a/docs/extensions/webdav/configuration.md b/docs/extensions/webdav/configuration.md new file mode 100644 index 000000000..7ae4a0486 --- /dev/null +++ b/docs/extensions/webdav/configuration.md @@ -0,0 +1,12 @@ +--- +title: Service Configuration +date: 2018-05-02T00:00:00+00:00 +weight: 20 +geekdocRepo: https://github.com/owncloud/ocis +geekdocEditPath: edit/master/docs/extensions/webdav +geekdocFilePath: configuration.md +geekdocCollapseSection: true +--- + + +{{< include file="extensions/_includes/webdav_configvars.md" >}} \ No newline at end of file diff --git a/docs/helpers/configenvextractor.go b/docs/helpers/configenvextractor.go new file mode 100644 index 000000000..bc504fc32 --- /dev/null +++ b/docs/helpers/configenvextractor.go @@ -0,0 +1,50 @@ +package main + +import ( + "fmt" + "io/ioutil" + "log" + "os" + "os/exec" + "path/filepath" + "strings" + "text/template" +) + +func main() { + fmt.Println("Getting relevant packages") + paths, err := filepath.Glob("../../*/pkg/config/defaultconfig.go") + if err != nil { + log.Fatal(err) + } + replacer := strings.NewReplacer( + "../../", "github.com/owncloud/ocis/", + "/defaultconfig.go", "", + ) + for i := range paths { + paths[i] = replacer.Replace(paths[i]) + } + content, err := ioutil.ReadFile("extractor.go.tmpl") + if err != nil { + log.Fatal(err) + } + fmt.Println("Generating intermediate go code") + tpl := template.Must(template.New("").Parse(string(content))) + os.Mkdir("output", 0700) + runner, err := os.Create("output/runner.go") + if err != nil { + log.Fatal(err) + } + tpl.Execute(runner, paths) + fmt.Println("Running intermediate go code") + os.Chdir("output") + os.Setenv("OCIS_BASE_DATA_PATH", "~/.ocis") + out, err := exec.Command("go", "run", "runner.go").Output() + if err != nil { + log.Fatal(err) + } + fmt.Println(string(out)) + fmt.Println("Cleaning up") + os.Chdir("../") + os.RemoveAll("output") +} diff --git a/docs/helpers/extractor.go.tmpl b/docs/helpers/extractor.go.tmpl new file mode 100644 index 000000000..3503ea227 --- /dev/null +++ b/docs/helpers/extractor.go.tmpl @@ -0,0 +1,85 @@ +package main + +import ( + "fmt" + "io/ioutil" + "log" + "os" + "path/filepath" + "reflect" + "strings" + "text/template" + + {{- range $key, $value := .}} + pkg{{$key}} "{{$value}}" + {{- end}}) + +type ConfigField struct { + Name string + DefaultValue string + Type string + Description string +} + +func main() { +fmt.Println("Generating documentation for environment variables:") +content, err := ioutil.ReadFile("../../../docs/templates/CONFIGURATION.tmpl") +if err != nil { + log.Fatal(err) +} +replacer := strings.NewReplacer( + "github.com/owncloud/ocis/", "", + "/pkg/config", "", + ) +var fields []ConfigField +var targetFile *os.File +tpl := template.Must(template.New("").Parse(string(content))) + +m := map[string]interface{}{ +{{- range $key, $value := .}} + "{{$value}}": *pkg{{$key}}.DefaultConfig(), +{{- end }} +} + + targetFolder := "../../../docs/extensions/_includes/" + for pkg, conf := range m { + fields = GetAnnotatedVariables(conf) + if len(fields) > 0 { + fmt.Printf("... %s\n", pkg) + targetFile, err = os.Create(filepath.Join(targetFolder, replacer.Replace(pkg) + "_configvars.md")) + if err != nil { + log.Fatalf("Failed to create target file: %s", err) + } + defer targetFile.Close() + if err := tpl.Execute(targetFile, fields); err != nil { + log.Fatalf("Failed to execute template: %s", err) + } + } + } + fmt.Println("done") +} + +func GetAnnotatedVariables(s interface{}) []ConfigField { + t := reflect.TypeOf(s) + v := reflect.ValueOf(s) + + var fields []ConfigField + for i := 0; i < t.NumField(); i++ { + field := t.Field(i) + value := v.Field(i) + + switch value.Kind() { + default: + desc := field.Tag.Get("desc") + env, ok := field.Tag.Lookup("env") + if !ok { + continue + } + v := fmt.Sprintf("%v", value.Interface()) + fields = append(fields, ConfigField{Name: env, DefaultValue: v, Description: desc, Type: value.Type().Name()}) + case reflect.Struct: + fields = append(fields, GetAnnotatedVariables(value.Interface())...) + } + } + return fields +} diff --git a/docs/templates/CONFIGURATION.tmpl b/docs/templates/CONFIGURATION.tmpl new file mode 100644 index 000000000..ffa87ae79 --- /dev/null +++ b/docs/templates/CONFIGURATION.tmpl @@ -0,0 +1,7 @@ +## Environment Variables + +| Name | Type | Default Value | Description | +|------|------|---------------|-------------| +{{- range .}} +| {{.Name}} | {{.Type}} | {{.DefaultValue}} | {{.Description}}| +{{- end }} \ No newline at end of file