lib: get the base of WORK_PATH from app.ini
instead of hardcoding forgejo-work-path to be the base of WORK_PATH relative to DIR, read it from the app.ini file. It will allow multiple Forgejo instances to run simultaneously, each using a different directory.
This commit is contained in:
parent
6f3f3ec0f2
commit
4a19e9c90b
7 changed files with 17 additions and 9 deletions
14
lib/lib.sh
14
lib/lib.sh
|
@ -52,7 +52,7 @@ function dependencies() {
|
|||
|
||||
if ! which make curl daemon git-lfs jq sqlite3 > /dev/null ; then
|
||||
$SUDO apt-get update -qq
|
||||
$SUDO apt-get install -y -qq make curl daemon git-lfs jq sqlite3 gettext-base
|
||||
$SUDO apt-get install -y -qq make curl daemon git-lfs jq sqlite3
|
||||
fi
|
||||
|
||||
if ! test -f /usr/local/bin/mc || ! test -f /usr/local/bin/minio ; then
|
||||
|
@ -247,10 +247,18 @@ function start() {
|
|||
|
||||
function reset_forgejo() {
|
||||
local config=$1
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
local work_path_base=$(sed -n -e 's/^WORK_PATH *= *\(.*\)/\1/p' < $config)
|
||||
if test -z "$work_path_base" ; then
|
||||
echo "no line found starting with WORK_PATH = in the file $config"
|
||||
return 1
|
||||
fi
|
||||
local work_path=$DIR/$work_path_base
|
||||
rm -fr $work_path
|
||||
mkdir -p $work_path
|
||||
IP=$IP WORK_PATH=$work_path envsubst < $config > $work_path/app.ini
|
||||
sed -e "s/\${IP}/$IP/g" \
|
||||
-e "s|\${WORK_PATH}|$work_path|g" \
|
||||
-e "s|^WORK_PATH = .*|WORK_PATH = $work_path|" \
|
||||
< $config > $work_path/app.ini
|
||||
}
|
||||
|
||||
function reset_minio() {
|
||||
|
|
Loading…
Add table
Reference in a new issue