From b5b57029cbd8ca1955e57fc6cbe31861e4deec57 Mon Sep 17 00:00:00 2001 From: Ben Yanke Date: Fri, 15 Jul 2022 22:53:56 -0400 Subject: [PATCH 1/3] Improve token and secret key generation docs Currently, the docs send you off to another page, and you have to piece the command together. This PR proposes a minor improvement to the docs which allows a user to paste a single command into their terminal and get the needed tokens and keys. --- docs/content/doc/installation/with-docker.en-us.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/content/doc/installation/with-docker.en-us.md b/docs/content/doc/installation/with-docker.en-us.md index c2e7a817c932a..fb186acc0a759 100644 --- a/docs/content/doc/installation/with-docker.en-us.md +++ b/docs/content/doc/installation/with-docker.en-us.md @@ -303,7 +303,13 @@ services: - GITEA__mailer__PASSWD="""${GITEA__mailer__PASSWD:?GITEA__mailer__PASSWD not set}""" ``` -To set required TOKEN and SECRET values, consider using Gitea's built-in [generate utility functions](https://docs.gitea.io/en-us/command-line/#generate). +To set required TOKEN and SECRET values, ensure you generate new values per installation. The following docker commands will make use of Gitea's built-in [generate utility functions](https://docs.gitea.io/en-us/command-line/#generate). + +```bash +docker run -it --rm gitea/gitea:1 gitea generate secret SECRET_KEY +docker run -it --rm gitea/gitea:1 gitea generate secret INTERNAL_TOKEN +``` + ## SSH Container Passthrough From 071e3640b0f8a0106cb99d0ebeb44a732af3b6ef Mon Sep 17 00:00:00 2001 From: Ben Yanke Date: Mon, 18 Jul 2022 09:23:39 -0400 Subject: [PATCH 2/3] make documentation more clear --- docs/content/doc/installation/with-docker.en-us.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/content/doc/installation/with-docker.en-us.md b/docs/content/doc/installation/with-docker.en-us.md index fb186acc0a759..1f4925c62791f 100644 --- a/docs/content/doc/installation/with-docker.en-us.md +++ b/docs/content/doc/installation/with-docker.en-us.md @@ -305,11 +305,21 @@ services: To set required TOKEN and SECRET values, ensure you generate new values per installation. The following docker commands will make use of Gitea's built-in [generate utility functions](https://docs.gitea.io/en-us/command-line/#generate). +The following commands will output a new `SECRET_KEY` and `INTERNAL_TOKEN` to `stdout`, which you can then place in your environment variables. + ```bash docker run -it --rm gitea/gitea:1 gitea generate secret SECRET_KEY docker run -it --rm gitea/gitea:1 gitea generate secret INTERNAL_TOKEN ``` +```yaml +... +services: + server: + environment: + - GITEA__security__SECRET_KEY=[value returned by generate secret SECRET_KEY] + - GITEA__security__INTERNAL_TOKEN=[value returned by generate secret INTERNAL_TOKEN] +``` ## SSH Container Passthrough From 5f20f7ac80b9a7f37d32b1366a735a54760c0028 Mon Sep 17 00:00:00 2001 From: Ben Yanke Date: Fri, 29 Jul 2022 23:42:48 -0400 Subject: [PATCH 3/3] Update docs/content/doc/installation/with-docker.en-us.md Co-authored-by: wxiaoguang --- docs/content/doc/installation/with-docker.en-us.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/doc/installation/with-docker.en-us.md b/docs/content/doc/installation/with-docker.en-us.md index 12d219db28d8f..895f04804e2bc 100644 --- a/docs/content/doc/installation/with-docker.en-us.md +++ b/docs/content/doc/installation/with-docker.en-us.md @@ -303,7 +303,7 @@ services: - GITEA__mailer__PASSWD="""${GITEA__mailer__PASSWD:?GITEA__mailer__PASSWD not set}""" ``` -To set required TOKEN and SECRET values, ensure you generate new values per installation. The following docker commands will make use of Gitea's built-in [generate utility functions](https://docs.gitea.io/en-us/command-line/#generate). +Gitea will generate new secrets/tokens for every new installation automatically and write them into the app.ini. If you want to set the secrets/tokens manually, you can use the following docker commands to use of Gitea's built-in [generate utility functions](https://docs.gitea.io/en-us/command-line/#generate). Do not lose/change your SECRET_KEY after the installation, otherwise the encrypted data can not be decrypted anymore. The following commands will output a new `SECRET_KEY` and `INTERNAL_TOKEN` to `stdout`, which you can then place in your environment variables.