Skip to content

Commit

Permalink
Alphine and migration mode
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielHougaard committed Jul 3, 2024
1 parent a10340b commit 81a1487
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
strategy:
matrix:
arch: [x64, arm64]
os: [linux, win]
os: [linux, alphine, win]
include:
- os: linux
target: node18-linux
Expand Down
35 changes: 5 additions & 30 deletions backend/src/lib/fn/argv.ts
Original file line number Diff line number Diff line change
@@ -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"));

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";
}
const args = process.argv.slice(2);
const migrationMode = args.find((arg) => arg === "migration:latest");

return value.toLowerCase() === "true";
} catch (err) {
logger.error(err, `Failed to check migration mode`);
return false;
if (migrationMode) {
return true;
}
return false;
};

0 comments on commit 81a1487

Please sign in to comment.