Browse Source

fix: pull repositories from their current branch instead of master

Nicolas Meienberger 2 years ago
parent
commit
d102f18f91
3 changed files with 8 additions and 3 deletions
  1. 6 1
      packages/system-api/src/server.ts
  2. 1 1
      scripts/git.sh
  3. 1 1
      scripts/system.sh

+ 6 - 1
packages/system-api/src/server.ts

@@ -27,12 +27,16 @@ let corsOptions = {
       return callback(null, true);
     }
     // disallow requests with no origin
-    if (!origin) return callback(new Error('Not allowed by CORS'), false);
+    if (!origin) {
+      logger.error('No origin');
+      return callback(new Error('Not allowed by CORS'), false);
+    }
 
     if (getConfig().clientUrls.includes(origin)) {
       return callback(null, true);
     }
 
+    logger.error(`Origin ${origin} not allowed by CORS`);
     const message = "The CORS policy for this origin doesn't allow access from the particular origin.";
     return callback(new Error(message), false);
   },
@@ -103,6 +107,7 @@ const main = async () => {
       // Start apps
       appsService.startAllApps();
       logger.info(`Server running on port ${port} 🚀 Production => ${__prod__}`);
+      logger.info(`Config: ${JSON.stringify(getConfig(), null, 2)}`);
     });
   } catch (error) {
     logger.error(error);

+ 1 - 1
scripts/git.sh

@@ -55,7 +55,7 @@ if [[ "$command" = "update" ]]; then
     write_log "Updating ${repo} in ${repo_hash}"
     cd "${repo_dir}" || exit
 
-    if ! git pull origin master; then
+    if ! git pull origin "$(git rev-parse --abbrev-ref HEAD)"; then
         cd "${ROOT_FOLDER}" || exit
         write_log "Failed to update repo"
         exit 1

+ 1 - 1
scripts/system.sh

@@ -27,7 +27,7 @@ if [[ "$command" = "update" ]]; then
 
     scripts/stop.sh
     git config --global --add safe.directory "${ROOT_FOLDER}"
-    git pull origin master
+    git pull origin "$(git rev-parse --abbrev-ref HEAD)"
     scripts/start.sh
     exit
 fi