Skip to content

Commit

Permalink
GITEA permit to disable users registration
Browse files Browse the repository at this point in the history
Signed-off-by: Ronan LE MEILLAT <eltorio@users.noreply.github.com>
  • Loading branch information
eltorio committed Oct 7, 2023
1 parent b99be70 commit 678500c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export GITEA_SMTP_HOST="${GITEA_SMTP_HOST:-}"
export GITEA_SMTP_FROM="${GITEA_SMTP_FROM:-}"
export GITEA_SMTP_USER="${GITEA_SMTP_USER:-}"
export GITEA_SMTP_PASSWORD="${GITEA_SMTP_PASSWORD:-}"
export GITEA_DISABLE_REGISTRATION="${GITEA_DISABLE_REGISTRATION:-false}"

# Gitea system parameters
export GITEA_DAEMON_USER="gitea"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ gitea_update_conf_file() {
is_empty_value "$GITEA_SMTP_PASSWORD" || gitea_conf_set "mailer" "PASSWD" "$GITEA_SMTP_PASSWORD"
is_empty_value "$GITEA_LFS_ROOT_PATH" || gitea_conf_set "lfs" "PATH" "$GITEA_LFS_ROOT_PATH"

gitea_conf_set "service" "DISABLE_REGISTRATION" "$GITEA_DISABLE_REGISTRATION"
}

########################
Expand Down Expand Up @@ -292,6 +293,11 @@ gitea_pass_wizard() {
"--data-urlencode" "admin_confirm_passwd=${GITEA_ADMIN_PASSWORD}"
"--data-urlencode" "admin_email=${GITEA_ADMIN_EMAIL}"
)
if is_boolean_yes "${GITEA_DISABLE_REGISTRATION}"; then
curl_data_opts+=(
"--data-urlencode" "disable_registration=on"
)
fi
# Note in version 1.18 SMTP configuration is different
if is_boolean_yes "${GITEA_SMTP_ENABLED}"; then
curl_data_opts+=(
Expand Down
4 changes: 4 additions & 0 deletions bitnami/gitea/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@ Gitea default ports can be changed using the following environment variables:
* `GITEA_HTTP_PORT`: HTTP port. Defaults to `3000`.
* `GITEA_SSH_LISTEN_PORT`: Port for the built-in SSH server. Defaults to `2222`

### Disabling new users registration

Setting `DISABLE_REGISTRATION` in `app.ini` permits to disable users to self register in Gitea after which only admin can create accounts for users. This can be easily controlled in Docker by setting this environment variable.

Check warning on line 231 in bitnami/gitea/README.md

View workflow job for this annotation

GitHub Actions / markdown-linter

MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
* `GITEA_DISABLE_REGISTRATION`: yes|no or "true"|"false"

Check warning on line 232 in bitnami/gitea/README.md

View workflow job for this annotation

GitHub Actions / markdown-linter

MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "* `GITEA_DISABLE_REGISTRATION`..."]

Check warning on line 232 in bitnami/gitea/README.md

View workflow job for this annotation

GitHub Actions / markdown-linter

MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "* `GITEA_DISABLE_REGISTRATION`..."]
## Logging

Check warning on line 233 in bitnami/gitea/README.md

View workflow job for this annotation

GitHub Actions / markdown-linter

MD022/blanks-around-headings/blanks-around-headers Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Above] [Context: "## Logging"]

The Bitnami Gitea Docker image sends the container logs to `stdout`. To view the logs:
Expand Down

0 comments on commit 678500c

Please sign in to comment.