Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
Postgres: fix type for host
Browse files Browse the repository at this point in the history
  • Loading branch information
fwang committed Oct 15, 2024
1 parent 4c2d777 commit d8223f5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions examples/internal/playground/sst.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default $config({
//const apiv2 = addApiV2();
//const app = addFunction();
//const service = addService();
//const postgres = addPostgres();
//const cron = addCron();

return ret;
Expand Down Expand Up @@ -77,5 +78,16 @@ export default $config({

return service;
}

function addPostgres() {
const postgres = new sst.aws.Postgres("MyPostgres", {
vpc,
});
ret.pgHost = postgres.host;
ret.pgPort = postgres.port;
ret.pgUsername = postgres.username;
ret.pgPassword = postgres.password;
return postgres;
}
},
});
2 changes: 1 addition & 1 deletion platform/src/components/aws/postgres.ts
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ export class Postgres extends Component implements Link.Linkable {
*/
public get host() {
return all([this.instance.endpoint, this.proxy]).apply(
([endpoint, proxy]) => proxy?.endpoint ?? endpoint.split(":")[0],
([endpoint, proxy]) => proxy?.endpoint ?? output(endpoint.split(":")[0]),
);
}

Expand Down

0 comments on commit d8223f5

Please sign in to comment.