Skip to content

Commit

Permalink
Make identity deletion job configurable (#365)
Browse files Browse the repository at this point in the history
* fix: make BACKBONE_VERSION configurable

* fix: make appsettings override location configurable
  • Loading branch information
jkoenig134 authored Dec 11, 2024
1 parent e3e7272 commit 697f11f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/transport/test/testHelpers/TestUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -656,24 +656,27 @@ export class TestUtil {
}

public static async runDeletionJob(): Promise<void> {
const backboneVersion = this.getBackboneEnvVar("BACKBONE_VERSION");
const backboneVersion = this.getBackboneVersion();
const appsettingsOverrideLocation = process.env.APPSETTINGS_OVERRIDE_LOCATION ?? `${__dirname}/../../../../.dev/appsettings.override.json`;

await new GenericContainer(`ghcr.io/nmshd/backbone-identity-deletion-jobs:${backboneVersion}`)
.withWaitStrategy(Wait.forOneShotStartup())
.withCommand(["--Worker", "ActualDeletionWorker"])
.withNetworkMode("backbone")
.withCopyFilesToContainer([{ source: `${__dirname}/../../../../.dev/appsettings.override.json`, target: "/app/appsettings.override.json" }])
.withCopyFilesToContainer([{ source: appsettingsOverrideLocation, target: "/app/appsettings.override.json" }])
.start();
}

private static getBackboneEnvVar(name: string) {
private static getBackboneVersion() {
if (process.env.BACKBONE_VERSION) return process.env.BACKBONE_VERSION;

const envFile = fs.readFileSync(path.resolve(`${__dirname}/../../../../.dev/compose.backbone.env`));
const env = envFile
.toString()
.split("\n")
.map((line) => line.split("="))
.reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {} as Record<string, string>);

return env[name];
return env["BACKBONE_VERSION"];
}
}

0 comments on commit 697f11f

Please sign in to comment.