Skip to content

Commit

Permalink
chore: self mutation (build.diff)
Browse files Browse the repository at this point in the history
Signed-off-by: monada-bot[bot] <[email protected]>
  • Loading branch information
monadabot committed Apr 22, 2024
1 parent 50467f5 commit 8a66197
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion libs/wingsdk/src/platform/platform-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ export class PlatformManager {
public async storeSecrets(secrets: Record<string, string>): Promise<void> {
const hooks = collectHooks(this.platformInstances);
if (!hooks.storeSecretsHook) {
throw new Error(`Cannot find a platform or platform extension that supports storing secrets`);
throw new Error(
`Cannot find a platform or platform extension that supports storing secrets`
);
}
await hooks.storeSecretsHook(secrets);
}
Expand Down
4 changes: 2 additions & 2 deletions libs/wingsdk/src/target-sim/platform.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from "fs";
import { join } from "path";
import { App } from "./app";
import { IPlatform } from "../platform";
import { join } from "path";

/**
* Sim Platform
Expand All @@ -17,7 +17,7 @@ export class Platform implements IPlatform {
public async storeSecrets(secrets: Record<string, string>): Promise<void> {
let existingSecretsContent = "";
const envFile = join(process.env.WING_SOURCE_DIR!, ".env");

try {
existingSecretsContent = fs.readFileSync(envFile, "utf8");
} catch (error) {}
Expand Down
4 changes: 2 additions & 2 deletions libs/wingsdk/test/target-sim/secret.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe("secrets", () => {
new cloud.Secret(app, "my_secret", {
name: "wing-sim-test-my-secret",
});

await fs.writeFile(SECRETS_FILE, "wing-sim-test-my-secret=secret-value");

const secretsContent = fs.readFileSync(SECRETS_FILE, "utf-8");
Expand All @@ -71,4 +71,4 @@ function tryParse(content: string): string | undefined {
} catch (err) {
return undefined;
}
}
}

0 comments on commit 8a66197

Please sign in to comment.