Create the gogs configuration
This commit is contained in:
parent
93066abc97
commit
81eebcb0c7
|
@ -6701,6 +6701,58 @@ function install_gogs {
|
||||||
|
|
||||||
add_ddns_domain $GIT_DOMAIN_NAME
|
add_ddns_domain $GIT_DOMAIN_NAME
|
||||||
|
|
||||||
|
# obtain the secret key
|
||||||
|
GOGS_SECRET_KEY=
|
||||||
|
if grep -q "Gogs secret key:" /home/$MY_USERNAME/README; then
|
||||||
|
GOGS_SECRET_KEY=$(cat /home/$MY_USERNAME/README | grep "Gogs secret key:" | awk -F ':' '{print $2}' | sed 's/^ *//')
|
||||||
|
else
|
||||||
|
GOGS_SECRET_KEY="$(openssl rand -base64 20 | cut -c1-18)"
|
||||||
|
echo "Gogs secret key:$GOGS_SECRET_KEY" >> /home/$MY_USERNAME/README
|
||||||
|
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README
|
||||||
|
fi
|
||||||
|
|
||||||
|
# create the configuration
|
||||||
|
if [ ! -d /home/git/go/src/github.com/gogits/gogs/custom/conf ]; then
|
||||||
|
mkdir -p /home/git/go/src/github.com/gogits/gogs/custom/conf
|
||||||
|
fi
|
||||||
|
GOGS_CONFIG_FILE=/home/git/go/src/github.com/gogits/gogs/custom/conf/app.ini
|
||||||
|
echo 'RUN_USER = git' > $GOGS_CONFIG_FILE
|
||||||
|
echo 'RUN_MODE = prod' >> $GOGS_CONFIG_FILE
|
||||||
|
echo '' >> $GOGS_CONFIG_FILE
|
||||||
|
echo '[database]' >> $GOGS_CONFIG_FILE
|
||||||
|
echo 'DB_TYPE = mysql' >> $GOGS_CONFIG_FILE
|
||||||
|
echo 'HOST = 127.0.0.1:3306' >> $GOGS_CONFIG_FILE
|
||||||
|
echo 'NAME = gogs' >> $GOGS_CONFIG_FILE
|
||||||
|
echo 'USER = root' >> $GOGS_CONFIG_FILE
|
||||||
|
echo "PASSWD = $MARIADB_PASSWORD" >> $GOGS_CONFIG_FILE
|
||||||
|
echo 'SSL_MODE = disable' >> $GOGS_CONFIG_FILE
|
||||||
|
echo 'PATH = data/gogs.db' >> $GOGS_CONFIG_FILE
|
||||||
|
echo '' >> $GOGS_CONFIG_FILE
|
||||||
|
echo '[repository]' >> $GOGS_CONFIG_FILE
|
||||||
|
echo 'ROOT = /home/git/gogs-repositories' >> $GOGS_CONFIG_FILE
|
||||||
|
echo '' >> $GOGS_CONFIG_FILE
|
||||||
|
echo '[server]' >> $GOGS_CONFIG_FILE
|
||||||
|
echo 'DOMAIN = coder.uk.to' >> $GOGS_CONFIG_FILE
|
||||||
|
echo 'HTTP_PORT = 3000' >> $GOGS_CONFIG_FILE
|
||||||
|
echo "ROOT_URL = http://$GIT_DOMAIN_NAME/"
|
||||||
|
echo "SSH_PORT = $SSH_PORT" >> $GOGS_CONFIG_FILE
|
||||||
|
echo '' >> $GOGS_CONFIG_FILE
|
||||||
|
echo '[session]' >> $GOGS_CONFIG_FILE
|
||||||
|
echo 'PROVIDER = file' >> $GOGS_CONFIG_FILE
|
||||||
|
echo '' >> $GOGS_CONFIG_FILE
|
||||||
|
echo '[log]' >> $GOGS_CONFIG_FILE
|
||||||
|
echo 'MODE = file' >> $GOGS_CONFIG_FILE
|
||||||
|
echo 'LEVEL = Info' >> $GOGS_CONFIG_FILE
|
||||||
|
echo '' >> $GOGS_CONFIG_FILE
|
||||||
|
echo '[security]' >> $GOGS_CONFIG_FILE
|
||||||
|
echo 'INSTALL_LOCK = true' >> $GOGS_CONFIG_FILE
|
||||||
|
echo "SECRET_KEY = $GOGS_SECRET_KEY"
|
||||||
|
echo '' >> $GOGS_CONFIG_FILE
|
||||||
|
echo '[service]' >> $GOGS_CONFIG_FILE
|
||||||
|
echo 'DISABLE_REGISTRATION = false' >> $GOGS_CONFIG_FILE
|
||||||
|
|
||||||
|
chown -R git:git /home/git
|
||||||
|
|
||||||
if ! grep -q "Gogs domain:" $COMPLETION_FILE; then
|
if ! grep -q "Gogs domain:" $COMPLETION_FILE; then
|
||||||
echo "Gogs domain:$GIT_DOMAIN_NAME" >> $COMPLETION_FILE
|
echo "Gogs domain:$GIT_DOMAIN_NAME" >> $COMPLETION_FILE
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue