about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorBenjamin Asbach <asbachb@users.noreply.github.com>2022-06-14 01:07:51 +0300
committerBenjamin Asbach <asbachb@users.noreply.github.com>2022-06-14 01:09:14 +0300
commit6b913c40f0761e6ebee8b5c3d8e53542463387f8 (patch)
tree560047ff007691c673ae155ea2f41c094101311e /nixos
parent914ef51ffa88d9b386c71bdc88bffc5273c08ada (diff)
gitea: bugfix: add check for empty file for secrets
There are some cases were the files are present but not filled with secrets. In these cases the service fails to startup.

This fixes #175967
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/misc/gitea.nix10
1 files changed, 5 insertions, 5 deletions
diff --git a/nixos/modules/services/misc/gitea.nix b/nixos/modules/services/misc/gitea.nix
index effa0c06ad6c5..81ec0d7c47e1b 100644
--- a/nixos/modules/services/misc/gitea.nix
+++ b/nixos/modules/services/misc/gitea.nix
@@ -506,24 +506,24 @@ in
           function gitea_setup {
             cp -f ${configFile} ${runConfig}
 
-            if [ ! -e ${secretKey} ]; then
+            if [ ! -s ${secretKey} ]; then
                 ${gitea}/bin/gitea generate secret SECRET_KEY > ${secretKey}
             fi
 
             # Migrate LFS_JWT_SECRET filename
-            if [[ -e ${oldLfsJwtSecret} && ! -e ${lfsJwtSecret} ]]; then
+            if [[ -s ${oldLfsJwtSecret} && ! -s ${lfsJwtSecret} ]]; then
                 mv ${oldLfsJwtSecret} ${lfsJwtSecret}
             fi
 
-            if [ ! -e ${oauth2JwtSecret} ]; then
+            if [ ! -s ${oauth2JwtSecret} ]; then
                 ${gitea}/bin/gitea generate secret JWT_SECRET > ${oauth2JwtSecret}
             fi
 
-            if [ ! -e ${lfsJwtSecret} ]; then
+            if [ ! -s ${lfsJwtSecret} ]; then
                 ${gitea}/bin/gitea generate secret LFS_JWT_SECRET > ${lfsJwtSecret}
             fi
 
-            if [ ! -e ${internalToken} ]; then
+            if [ ! -s ${internalToken} ]; then
                 ${gitea}/bin/gitea generate secret INTERNAL_TOKEN > ${internalToken}
             fi