Skip to content

Commit b7263f3

Browse files
committed
Replace GOGS with GITEA in variable names
Still use GOGS_WORK_DIR and GOGS_CUSTOM env variables as a fallback if the equivalent GITEA_* are not set, warning user about the need for change. Does not change "gogs" to "gitea" in webhook type name Because "gogs" hook type is part of the API (routes) and used in templates... Closes #87
1 parent 1b962ba commit b7263f3

File tree

10 files changed

+44
-28
lines changed

10 files changed

+44
-28
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ADD https://github.com/tianon/gosu/releases/download/1.9/gosu-amd64 /usr/sbin/go
66
RUN chmod +x /usr/sbin/gosu \
77
&& apk --no-cache --no-progress add ca-certificates bash git linux-pam s6 curl openssh socat tzdata
88

9-
ENV GOGS_CUSTOM /data/gogs
9+
ENV GITEA_CUSTOM /data/gogs
1010

1111
COPY . /app/gogs/
1212
WORKDIR /app/gogs/

Dockerfile.rpi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ RUN chmod +x /usr/sbin/gosu \
99
&& apk -U --no-progress upgrade && rm -f /var/cache/apk/APKINDEX.* \
1010
&& apk --no-cache --no-progress add ca-certificates bash git linux-pam s6 curl openssh socat tzdata
1111

12-
ENV GOGS_CUSTOM /data/gogs
12+
ENV GITEA_CUSTOM /data/gogs
1313

1414
COPY . /app/gogs/
1515
WORKDIR /app/gogs/

docker/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ apk --no-progress del build-deps
3333

3434
# Create git user for Gogs
3535
adduser -H -D -g 'Gogs Git User' git -h /data/git -s /bin/bash && passwd -u git
36-
echo "export GOGS_CUSTOM=${GOGS_CUSTOM}" >> /etc/profile
36+
echo "export GITEA_CUSTOM=${GITEA_CUSTOM}" >> /etc/profile

docker/s6/gogs/setup

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ if ! test -d ~git/.ssh; then
66
fi
77

88
if ! test -f ~git/.ssh/environment; then
9-
echo "GOGS_CUSTOM=${GOGS_CUSTOM}" > ~git/.ssh/environment
9+
echo "GITEA_CUSTOM=${GITEA_CUSTOM}" > ~git/.ssh/environment
1010
chmod 600 ~git/.ssh/environment
1111
fi
1212

models/pull.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ var PullRequestQueue = sync.NewUniqueQueue(setting.Repository.PullRequestQueueLe
2626
type PullRequestType int
2727

2828
const (
29-
PULL_REQUEST_GOGS PullRequestType = iota
29+
PULL_REQUEST_GITEA PullRequestType = iota
3030
PLLL_ERQUEST_GIT
3131
)
3232

modules/setting/setting.go

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,18 @@ func init() {
297297

298298
// WorkDir returns absolute path of work directory.
299299
func WorkDir() (string, error) {
300-
wd := os.Getenv("GOGS_WORK_DIR")
300+
wd := os.Getenv("GITEA_WORK_DIR")
301301
if len(wd) > 0 {
302302
return wd, nil
303303
}
304+
// Use GOGS_WORK_DIR if available, for backward compatibility
305+
// TODO: drop in 1.1.0 ?
306+
wd = os.Getenv("GOGS_WORK_DIR")
307+
if len(wd) > 0 {
308+
log.Warn(`Usage of GOGS_WORK_DIR is deprecated and will be *removed* in a future release,
309+
please consider changing to GITEA_WORK_DIR`)
310+
return wd, nil
311+
}
304312

305313
i := strings.LastIndex(AppPath, "/")
306314
if i == -1 {
@@ -341,9 +349,17 @@ func NewContext() {
341349
log.Fatal(4, "Fail to parse 'conf/app.ini': %v", err)
342350
}
343351

344-
CustomPath = os.Getenv("GOGS_CUSTOM")
352+
CustomPath = os.Getenv("GITEA_CUSTOM")
345353
if len(CustomPath) == 0 {
346-
CustomPath = workDir + "/custom"
354+
// For backward compatibility
355+
// TODO: drop in 1.1.0 ?
356+
CustomPath = os.Getenv("GOGS_CUSTOM")
357+
if len(CustomPath) == 0 {
358+
CustomPath = workDir + "/custom"
359+
} else {
360+
log.Warn(`Usage of GOGS_CUSTOM is deprecated and will be *removed* in a future release,
361+
please consider changing to GITEA_CUSTOM`)
362+
}
347363
}
348364

349365
if len(CustomConf) == 0 {

routers/repo/pull.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ func CompareAndPullRequestPost(ctx *context.Context, form auth.CreateIssueForm)
687687
HeadRepo: headRepo,
688688
BaseRepo: repo,
689689
MergeBase: prInfo.MergeBase,
690-
Type: models.PULL_REQUEST_GOGS,
690+
Type: models.PULL_REQUEST_GITEA,
691691
}
692692
// FIXME: check error in the case two people send pull request at almost same time, give nice error prompt
693693
// instead of 500.

scripts/init/centos/gogs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,32 @@
2424
# Default values
2525

2626
NAME=gogs
27-
GOGS_HOME=/home/git/gogs
28-
GOGS_PATH=${GOGS_HOME}/$NAME
29-
GOGS_USER=git
27+
GITEA_HOME=/home/git/gogs
28+
GITEA_PATH=${GITEA_HOME}/$NAME
29+
GITEA_USER=git
3030
SERVICENAME="Gogs Go Git Service"
3131
LOCKFILE=/var/lock/subsys/gogs
32-
LOGPATH=${GOGS_HOME}/log
32+
LOGPATH=${GITEA_HOME}/log
3333
LOGFILE=${LOGPATH}/gogs.log
3434
RETVAL=0
3535

3636
# Read configuration from /etc/sysconfig/gogs to override defaults
3737
[ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
3838

3939
# Don't do anything if nothing is installed
40-
[ -x ${GOGS_PATH} ] || exit 0
40+
[ -x ${GITEA_PATH} ] || exit 0
4141
# exit if logpath dir is not created.
4242
[ -x ${LOGPATH} ] || exit 0
4343

4444
DAEMON_OPTS="--check $NAME"
4545

4646
# Set additional options, if any
47-
[ ! -z "$GOGS_USER" ] && DAEMON_OPTS="$DAEMON_OPTS --user=${GOGS_USER}"
47+
[ ! -z "$GITEA_USER" ] && DAEMON_OPTS="$DAEMON_OPTS --user=${GITEA_USER}"
4848

4949
start() {
50-
cd ${GOGS_HOME}
50+
cd ${GITEA_HOME}
5151
echo -n "Starting ${SERVICENAME}: "
52-
daemon $DAEMON_OPTS "${GOGS_PATH} web > ${LOGFILE} 2>&1 &"
52+
daemon $DAEMON_OPTS "${GITEA_PATH} web > ${LOGFILE} 2>&1 &"
5353
RETVAL=$?
5454
echo
5555
[ $RETVAL = 0 ] && touch ${LOCKFILE}
@@ -58,7 +58,7 @@ start() {
5858
}
5959

6060
stop() {
61-
cd ${GOGS_HOME}
61+
cd ${GITEA_HOME}
6262
echo -n "Shutting down ${SERVICENAME}: "
6363
killproc ${NAME}
6464
RETVAL=$?

scripts/init/freebsd/gogs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ gogs_start() {
3838

3939
gogs_stop() {
4040
if [ ! -f $pidfile ]; then
41-
echo "GOGS PID File not found. Maybe GOGS is not running?"
41+
echo "GITEA PID File not found. Maybe GITEA is not running?"
4242
else
4343
kill $(cat $pidfile)
4444
fi

scripts/init/suse/gogs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
# Default values
1919

2020
NAME=gogs
21-
GOGS_HOME=/home/git/gogs
22-
GOGS_PATH=${GOGS_HOME}/$NAME
23-
GOGS_USER=git
21+
GITEA_HOME=/home/git/gogs
22+
GITEA_PATH=${GITEA_HOME}/$NAME
23+
GITEA_USER=git
2424
SERVICENAME="Go Git Service"
2525
LOCKFILE=/var/lock/subsys/gogs
26-
LOGPATH=${GOGS_HOME}/log
26+
LOGPATH=${GITEA_HOME}/log
2727
LOGFILE=${LOGPATH}/error.log
2828
# gogs creates its own gogs.log from stdout
2929
RETVAL=0
@@ -32,7 +32,7 @@ RETVAL=0
3232
[ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
3333

3434
# Don't do anything if nothing is installed
35-
test -x ${GOGS_PATH} || { echo "$NAME not installed";
35+
test -x ${GITEA_PATH} || { echo "$NAME not installed";
3636
if [ "$1" = "stop" ]; then exit 0;
3737
else exit 5; fi; }
3838

@@ -53,12 +53,12 @@ case "$1" in
5353
echo -n "Starting ${SERVICENAME} "
5454

5555
# As we can't use startproc, we have to check ourselves if the service is already running
56-
/sbin/checkproc ${GOGS_PATH}
56+
/sbin/checkproc ${GITEA_PATH}
5757
if [ $? -eq 0 ]; then
5858
# return skipped as service is already running
5959
(exit 5)
6060
else
61-
su - ${GOGS_USER} -c "USER=${GOGS_USER} ${GOGS_PATH} web 2>&1 >>${LOGFILE} &"
61+
su - ${GITEA_USER} -c "USER=${GITEA_USER} ${GITEA_PATH} web 2>&1 >>${LOGFILE} &"
6262
fi
6363

6464
# Remember status and be verbose
@@ -70,7 +70,7 @@ case "$1" in
7070

7171
## Stop daemon with killproc(8) and if this fails
7272
## killproc sets the return value according to LSB.
73-
/sbin/killproc ${GOGS_PATH}
73+
/sbin/killproc ${GITEA_PATH}
7474

7575
# Remember status and be verbose
7676
rc_status -v
@@ -100,7 +100,7 @@ case "$1" in
100100
# 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.)
101101

102102
# NOTE: checkproc returns LSB compliant status values.
103-
/sbin/checkproc ${GOGS_PATH}
103+
/sbin/checkproc ${GITEA_PATH}
104104
# NOTE: rc_status knows that we called this init script with
105105
# "status" option and adapts its messages accordingly.
106106
rc_status -v

0 commit comments

Comments
 (0)