Skip to content

Commit 2b94b02

Browse files
benyankewxiaoguang
andauthored
Improve token and secret key generation docs (#20387)
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. Co-authored-by: wxiaoguang <[email protected]>
1 parent 33bb7c4 commit 2b94b02

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

docs/content/doc/installation/with-docker.en-us.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,23 @@ services:
303303
- GITEA__mailer__PASSWD="""${GITEA__mailer__PASSWD:?GITEA__mailer__PASSWD not set}"""
304304
```
305305

306-
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).
306+
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.
307+
308+
The following commands will output a new `SECRET_KEY` and `INTERNAL_TOKEN` to `stdout`, which you can then place in your environment variables.
309+
310+
```bash
311+
docker run -it --rm gitea/gitea:1 gitea generate secret SECRET_KEY
312+
docker run -it --rm gitea/gitea:1 gitea generate secret INTERNAL_TOKEN
313+
```
314+
315+
```yaml
316+
...
317+
services:
318+
server:
319+
environment:
320+
- GITEA__security__SECRET_KEY=[value returned by generate secret SECRET_KEY]
321+
- GITEA__security__INTERNAL_TOKEN=[value returned by generate secret INTERNAL_TOKEN]
322+
```
307323
308324
## SSH Container Passthrough
309325

0 commit comments

Comments
 (0)