Browse Source

Change gogs port number

Bob Mottram 6 years ago
parent
commit
e1a877eb67
1 changed files with 12 additions and 2 deletions
  1. 12
    2
      src/freedombone-app-gogs

+ 12
- 2
src/freedombone-app-gogs View File

@@ -150,6 +150,18 @@ function upgrade_gogs {
150 150
         return
151 151
     fi
152 152
 
153
+    GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
154
+    GOGS_CONFIG_FILE=$GOGS_CONFIG_PATH/app.ini
155
+
156
+    # Change port number if necessary
157
+    if ! grep -q "HTTP_PORT = ${GOGS_PORT}" "${GOGS_CONFIG_FILE}"; then
158
+        sed -i "s|HTTP_PORT =.*|HTTP_PORT = ${GOGS_PORT}|g" "${GOGS_CONFIG_FILE}"
159
+        read_config_param GIT_DOMAIN_NAME
160
+        sed -i "s|proxy_pass .*|proxy_pass http://localhost:${GOGS_PORT};|g" "/etc/nginx/sites-available/${GIT_DOMAIN_NAME}"
161
+        systemctl restart gogs
162
+        systemctl restart nginx
163
+    fi
164
+
153 165
     CURR_GOGS_VERSION=$(get_completion_param "gogs version")
154 166
     echo "gogs current version: ${CURR_GOGS_VERSION}"
155 167
     echo "gogs app version: ${GOGS_VERSION}"
@@ -157,8 +169,6 @@ function upgrade_gogs {
157 169
         return
158 170
     fi
159 171
 
160
-    GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
161
-    GOGS_CONFIG_FILE=$GOGS_CONFIG_PATH/app.ini
162 172
     cp "$GOGS_CONFIG_FILE $INSTALL_DIR/gogs_config.ini"
163 173
 
164 174
     if [ -d "$INSTALL_DIR/gogs-repositories" ]; then