Skip to content

Commit

Permalink
Read from secrets manager for prod
Browse files Browse the repository at this point in the history
  • Loading branch information
DiegoVictor committed Jul 18, 2024
1 parent 1c2e72b commit 33cd4f2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/infra/database/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ const manager = {
},
getUrl: async () => {
if (env.NODE_ENV === "prod") {
return env.DATABASE_URL;
}
const { username, password } = await secretManager.getSecret(
env.CLUSTER_SECRET_ID
);
const encoded = encodeURIComponent(password);

const { username, password } = await secretManager.getSecret(
env.CLUSTER_SECRET_ID
);
const encoded = encodeURIComponent(password);
return `postgresql://${username}:${encoded}@${env.CLUSTER_URL}/coderunner?schema=public`;
}

return `postgresql://${username}:${encoded}@${env.CLUSTER_URL}/coderunner?schema=public`;
return env.DATABASE_URL;
},
connect: async () => {
if (!manager.client) {
Expand Down

0 comments on commit 33cd4f2

Please sign in to comment.