Skip to content

Commit

Permalink
Read connection URL from environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
DiegoVictor committed Jun 14, 2024
1 parent a718492 commit d005a97
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/migrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ const { SecretsManager } = require("@aws-sdk/client-secrets-manager");
const { command } = require("./common/command");

module.exports.handler = async () => {
const secretsManager = new SecretsManager({});
const secret = await secretsManager.getSecretValue({
SecretId: process.env.DB_SECRET,
});
const { username, password } = JSON.parse(secret.SecretString);
// const secretsManager = new SecretsManager({});
// const secret = await secretsManager.getSecretValue({
// SecretId: process.env.DB_SECRET,
// });
// const { username, password } = JSON.parse(secret.SecretString);

const DATABASE_URL = `postgresql://${username}:${password}@${process.env.DB_HOST}/coderunner?schema=public`;
// const DATABASE_URL = `postgresql://${username}:${password}@${process.env.DB_HOST}/coderunner?schema=public`;

const output = await command(
`DATABASE_URL=${DATABASE_URL} npx prisma migrate deploy`
`DATABASE_URL=${process.env.DATABASE_URL} npx prisma migrate deploy`
);
console.log(output);
};

0 comments on commit d005a97

Please sign in to comment.