From f186cb4d7bc9e90734a80ab9dd1bdee135c0efa3 Mon Sep 17 00:00:00 2001 From: Daniel Hougaard <62331820+DanielHougaard@users.noreply.github.com> Date: Wed, 3 Jul 2024 20:04:03 +0200 Subject: [PATCH] Alphine and migration mode --- .github/workflows/build-binaries.yml | 2 +- backend/src/lib/fn/argv.ts | 35 ++++------------------------ 2 files changed, 6 insertions(+), 31 deletions(-) diff --git a/.github/workflows/build-binaries.yml b/.github/workflows/build-binaries.yml index 5dc06b42f..c220c99f0 100644 --- a/.github/workflows/build-binaries.yml +++ b/.github/workflows/build-binaries.yml @@ -23,7 +23,7 @@ jobs: strategy: matrix: arch: [x64, arm64] - os: [linux, win] + os: [linux, alphine, win] include: - os: linux target: node18-linux diff --git a/backend/src/lib/fn/argv.ts b/backend/src/lib/fn/argv.ts index d9e245b11..7feb347bc 100644 --- a/backend/src/lib/fn/argv.ts +++ b/backend/src/lib/fn/argv.ts @@ -1,34 +1,9 @@ -import { logger } from "../logger"; - export const isMigrationMode = () => { - try { - const args = process.argv.slice(2); - const migrationFlag = args.find((arg) => arg.startsWith("--migration-mode")); + const args = process.argv.slice(2); + const migrationMode = args.find((arg) => arg === "migration:latest"); - if (!migrationFlag) { - return false; - } - - // Covers the case where the flag is --migration-mode [true|false|...] - if (migrationFlag === "--migration-mode") { - const nextArg = args[args.indexOf(migrationFlag) + 1]; - if (nextArg === "false") { - return false; - } - // --migration-mode without a value defaults to true - return nextArg === undefined || nextArg.toLowerCase() === "true"; - } - - // Covers the case where the flag is --migration-mode=[...] - const [, value] = migrationFlag.split("="); - if (value === undefined) { - const nextArg = args[args.indexOf(migrationFlag) + 1]; - return nextArg === "true"; - } - - return value.toLowerCase() === "true"; - } catch (err) { - logger.error(err, `Failed to check migration mode`); - return false; + if (migrationMode) { + return true; } + return false; };