From 01d5ecc6483c25ab20a8ea5f85bcf12c21f0846c Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Thu, 11 Mar 2021 13:48:20 +0100 Subject: [PATCH] Add documentation for configuration Signed-off-by: Knut Ahlers --- Makefile | 4 ++++ README.md | 10 ++++++++++ config.md | 4 ++++ service_github.go | 2 ++ 4 files changed, 20 insertions(+) create mode 100644 Makefile create mode 100644 config.md diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..67ce37c --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +documentation: + echo "| Key | Type | Description |" >config.md + echo "| --- | ---- | ----------- |" >>config.md + awk -F ' - ' '/#configStore/{ gsub(/.*configStore /, "", $$1); printf "| %s | %s | %s |\n", $$1, $$2, $$3 }' *.go | sort >>config.md diff --git a/README.md b/README.md index 6bc8809..0b6ca7d 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,16 @@ To embed them into Markdown pages like this `README.md`: - There is a [Docker container](https://quay.io/repository/luzifer/badge-gen) for it. Just start it and use your own URL +For configuration options see [config.md](config.md). These need to be supplied in a YAML file: + +```yaml +--- + +key: value + +... +``` + ### Popular buttons rebuilt Hint: To get the source just look into the source of this README.md diff --git a/config.md b/config.md new file mode 100644 index 0000000..3935276 --- /dev/null +++ b/config.md @@ -0,0 +1,4 @@ +| Key | Type | Description | +| --- | ---- | ----------- | +| github.personal_token | string | Token for Github auth to increase API requests | +| github.username | string | Username for Github auth to increase API requests | diff --git a/service_github.go b/service_github.go index ecf4a92..b066e4b 100644 --- a/service_github.go +++ b/service_github.go @@ -298,6 +298,8 @@ func (g githubServiceHandler) fetchAPI(ctx context.Context, path string, headers } } + // #configStore github.username - string - Username for Github auth to increase API requests + // #configStore github.personal_token - string - Token for Github auth to increase API requests if configStore.Str("github.personal_token") != "" { req.SetBasicAuth(configStore.Str("github.username"), configStore.Str("github.personal_token")) }