From bc455ed257a617bb1c033157578c4f864ff4d527 Mon Sep 17 00:00:00 2001 From: silverwind Date: Mon, 30 Nov 2020 20:52:04 +0100 Subject: [PATCH] Set RUN_MODE prod by default (#13765) I think it's a bad default to have "dev" as the default run mode which enables debugging and now also disables HTTP caching. It's better to just default to a value suitable for general deployments. Co-authored-by: techknowlogick --- custom/conf/app.example.ini | 4 ++-- docker/root/etc/s6/gitea/setup | 2 +- docker/rootless/usr/local/bin/docker-setup.sh | 2 +- docs/content/doc/advanced/config-cheat-sheet.en-us.md | 4 +--- docs/content/doc/installation/with-docker-rootless.en-us.md | 2 +- docs/content/doc/installation/with-docker.en-us.md | 2 +- modules/setting/setting.go | 2 +- 7 files changed, 8 insertions(+), 10 deletions(-) diff --git a/custom/conf/app.example.ini b/custom/conf/app.example.ini index b9f015bf0..af60fd8b6 100644 --- a/custom/conf/app.example.ini +++ b/custom/conf/app.example.ini @@ -8,8 +8,8 @@ APP_NAME = Gitea: Git with a cup of tea ; Change it if you run locally RUN_USER = git -; Either "dev", "prod" or "test", default is "dev" -RUN_MODE = dev +; Application run mode, affects performance and debugging. Either "dev", "prod" or "test", default is "prod" +RUN_MODE = prod [project] ; Default templates for project boards diff --git a/docker/root/etc/s6/gitea/setup b/docker/root/etc/s6/gitea/setup index 892fa7fd2..4449420b9 100755 --- a/docker/root/etc/s6/gitea/setup +++ b/docker/root/etc/s6/gitea/setup @@ -25,7 +25,7 @@ if [ ! -f ${GITEA_CUSTOM}/conf/app.ini ]; then # Substitude the environment variables in the template APP_NAME=${APP_NAME:-"Gitea: Git with a cup of tea"} \ - RUN_MODE=${RUN_MODE:-"dev"} \ + RUN_MODE=${RUN_MODE:-"prod"} \ DOMAIN=${DOMAIN:-"localhost"} \ SSH_DOMAIN=${SSH_DOMAIN:-"localhost"} \ HTTP_PORT=${HTTP_PORT:-"3000"} \ diff --git a/docker/rootless/usr/local/bin/docker-setup.sh b/docker/rootless/usr/local/bin/docker-setup.sh index 1ee8c2c97..9764ff3c5 100755 --- a/docker/rootless/usr/local/bin/docker-setup.sh +++ b/docker/rootless/usr/local/bin/docker-setup.sh @@ -27,7 +27,7 @@ if [ ! -f ${GITEA_APP_INI} ]; then # Substitude the environment variables in the template APP_NAME=${APP_NAME:-"Gitea: Git with a cup of tea"} \ - RUN_MODE=${RUN_MODE:-"dev"} \ + RUN_MODE=${RUN_MODE:-"prod"} \ RUN_USER=${USER:-"git"} \ SSH_DOMAIN=${SSH_DOMAIN:-"localhost"} \ HTTP_PORT=${HTTP_PORT:-"3000"} \ diff --git a/docs/content/doc/advanced/config-cheat-sheet.en-us.md b/docs/content/doc/advanced/config-cheat-sheet.en-us.md index 18acbf0aa..8427523f6 100644 --- a/docs/content/doc/advanced/config-cheat-sheet.en-us.md +++ b/docs/content/doc/advanced/config-cheat-sheet.en-us.md @@ -36,9 +36,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`. - `APP_NAME`: **Gitea: Git with a cup of tea**: Application name, used in the page title. - `RUN_USER`: **git**: The user Gitea will run as. This should be a dedicated system (non-user) account. Setting this incorrectly will cause Gitea to not start. -- `RUN_MODE`: **dev**: For performance and other purposes, change this to `prod` when - deployed to a production environment. The installation process will set this to `prod` - automatically. \[prod, dev, test\] +- `RUN_MODE`: **prod**: Application run mode, affects performance and debugging. Either "dev", "prod" or "test". ## Repository (`repository`) diff --git a/docs/content/doc/installation/with-docker-rootless.en-us.md b/docs/content/doc/installation/with-docker-rootless.en-us.md index 628053178..b85663720 100644 --- a/docs/content/doc/installation/with-docker-rootless.en-us.md +++ b/docs/content/doc/installation/with-docker-rootless.en-us.md @@ -240,7 +240,7 @@ You can configure some of Gitea's settings via environment variables: (Default values are provided in **bold**) * `APP_NAME`: **"Gitea: Git with a cup of tea"**: Application name, used in the page title. -* `RUN_MODE`: **dev**: For performance and other purposes, change this to `prod` when deployed to a production environment. +* `RUN_MODE`: **prod**: Application run mode, affects performance and debugging. Either "dev", "prod" or "test". * `SSH_DOMAIN`: **localhost**: Domain name of this server, used for the displayed clone URL in Gitea's UI. * `SSH_PORT`: **2222**: SSH port displayed in clone URL. * `SSH_LISTEN_PORT`: **%(SSH\_PORT)s**: Port for the built-in SSH server. diff --git a/docs/content/doc/installation/with-docker.en-us.md b/docs/content/doc/installation/with-docker.en-us.md index 4d0f35a00..79f825a0f 100644 --- a/docs/content/doc/installation/with-docker.en-us.md +++ b/docs/content/doc/installation/with-docker.en-us.md @@ -257,7 +257,7 @@ You can configure some of Gitea's settings via environment variables: (Default values are provided in **bold**) * `APP_NAME`: **"Gitea: Git with a cup of tea"**: Application name, used in the page title. -* `RUN_MODE`: **dev**: For performance and other purposes, change this to `prod` when deployed to a production environment. +* `RUN_MODE`: **prod**: Application run mode, affects performance and debugging. Either "dev", "prod" or "test". * `DOMAIN`: **localhost**: Domain name of this server, used for the displayed http clone URL in Gitea's UI. * `SSH_DOMAIN`: **localhost**: Domain name of this server, used for the displayed ssh clone URL in Gitea's UI. If the install page is enabled, SSH Domain Server takes DOMAIN value in the form (which overwrite this setting on save). * `SSH_PORT`: **22**: SSH port displayed in clone URL. diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 79e775190..63ae15af9 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -848,7 +848,7 @@ func NewContext() { } RunUser = Cfg.Section("").Key("RUN_USER").MustString(user.CurrentUsername()) - RunMode = Cfg.Section("").Key("RUN_MODE").MustString("dev") + RunMode = Cfg.Section("").Key("RUN_MODE").MustString("prod") // Does not check run user when the install lock is off. if InstallLock { currentUser, match := IsRunUserMatchCurrentUser(RunUser)