summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Matthias Lucas Jaros <jarlucmat@mailbox.org>2025-10-20 10:23:46 +0200
committerGravatar Matthias Lucas Jaros <jarlucmat@mailbox.org>2025-10-20 10:23:46 +0200
commitf701015dcce565ab9323a4057b3577f61999601f (patch)
tree316a1a6e6ca6c46a5a5d50b3ea4cb09b2b26269d /src
parent9d9355a379f8a9922645ecd87b66f68acbb6bc89 (diff)
Renamed variables again to avoid collision with global docker environment variables
Diffstat (limited to 'src')
-rwxr-xr-xsrc/init10
-rwxr-xr-xsrc/run8
2 files changed, 9 insertions, 9 deletions
diff --git a/src/init b/src/init
index 61ab8a1..b9222f4 100755
--- a/src/init
+++ b/src/init
@@ -6,8 +6,8 @@
#
#
-set REPO_PERMISSIONS_FILE /etc/repo-permissions
-set REPO_VALIDATION_REGEX "^((?:\/[a-zA-Z-]+)+.git)\$"
+set _REPO_PERMISSIONS_FILE /etc/repo-permissions
+set _REPO_VALIDATION_REGEX "^((?:\/[a-zA-Z-]+)+.git)\$"
function createUser
set -l userConfig (string split ':' $argv[1])
@@ -37,7 +37,7 @@ function setupRepo
set -l repo $parsedConfig[1]
# check repo name
- set -l matcher (string match -r -g $REPO_VALIDATION_REGEX $repo)
+ set -l matcher (string match -r -g $_REPO_VALIDATION_REGEX $repo)
if test -z $matcher[1]
echo "Invalid repo name $repo"
return 1
@@ -50,7 +50,7 @@ function setupRepo
# write user as allowed into permission file
for user in $parsedConfig[2..]
- echo "$repoDir:$user" >> $REPO_PERMISSIONS_FILE
+ echo "$repoDir:$user" >> $_REPO_PERMISSIONS_FILE
end
# setup repo dir
@@ -107,7 +107,7 @@ for userConfig in $users
end
# Setup repos
-echo > $REPO_PERMISSIONS_FILE
+echo > $_REPO_PERMISSIONS_FILE
for repoConfig in $repos
setupRepo "$repoConfig"
end
diff --git a/src/run b/src/run
index a1ae7d5..10d69c8 100755
--- a/src/run
+++ b/src/run
@@ -1,11 +1,11 @@
#!/usr/bin/env fish
-set REPO_PERMISSIONS_FILE /etc/repo-permissions
+set _REPO_PERMISSIONS_FILE /etc/repo-permissions
# unify repo regex somehow
-set GIT_VALIDATION_REGEX "^(git-(?:upload-pack|receive-pack|upload-archive)) '((?:\/[a-zA-Z-]+)+.git)'\$"
+set _GIT_VALIDATION_REGEX "^(git-(?:upload-pack|receive-pack|upload-archive)) '((?:\/[a-zA-Z-]+)+.git)'\$"
# check given git command
-set -l matcher (string match -r -g $GIT_VALIDATION_REGEX "$argv")
+set -l matcher (string match -r -g $_GIT_VALIDATION_REGEX "$argv")
if test (count $matcher) -ne 2
# there should be two groups otherwise something is wrong
exit 1
@@ -18,7 +18,7 @@ set -l repo $matcher[2]
# adjust repo path to /srv/repos
set -l repoDir srv repos
set -l repoDir /(string join -n '/' $repoDir (string split '/' $repo))
-cat $REPO_PERMISSIONS_FILE | grep -q -E "^$repoDir:$checkUser\$"
+cat $_REPO_PERMISSIONS_FILE | grep -q -E "^$repoDir:$checkUser\$"
or exit 1;
# execute parsed git command