diff --git a/containers/api.w b/containers/api.w index 62e658d2..ebefee7a 100644 --- a/containers/api.w +++ b/containers/api.w @@ -26,4 +26,4 @@ pub struct ContainerOpts { pub struct WorkloadProps extends ContainerOpts { -} \ No newline at end of file +} diff --git a/postgres/lib.w b/postgres/lib.w index 669f0e5c..649fc49d 100644 --- a/postgres/lib.w +++ b/postgres/lib.w @@ -96,13 +96,19 @@ pub class Database { let sim = new DatabaseSim(props); this.connection = sim.connection; this.inner = sim; + new ui.ValueField("Port", sim.port) as "port"; + + new ui.Field("Connection", inflight () => { + return "postgresql://{sim.connection.user}:{sim.connection.password}@localhost:{sim.port}/{sim.connection.database}"; + }, link: true) as "connection"; + + nodeof(sim).hidden = true; } elif target == "tf-aws" { let tfawsParams = RequiredTFAwsProps.fromJson(app.parameters.read(schema: RequiredTFAwsProps.schema())); if tfawsParams.postgresEngine == "rds" { let aurora = new DatabaseRDS(props); this.connection = aurora.connection; this.inner = aurora; - } elif tfawsParams.postgresEngine == "neon" { let neon = new DatabaseNeon(props); this.connection = neon.connection; @@ -284,7 +290,7 @@ class DatabaseRDS impl IDatabase { } class DatabaseSim impl IDatabase { - port: str; + pub port: str; pub connection: ConnectionOptions; @@ -323,8 +329,6 @@ class DatabaseSim impl IDatabase { port: this.port, ssl: false, }; - - new ui.ValueField("Postgres Port", this.port); } pub inflight connectionOptions(): ConnectionOptions { diff --git a/postgres/package-lock.json b/postgres/package-lock.json index 7d391a63..aaaaafd4 100644 --- a/postgres/package-lock.json +++ b/postgres/package-lock.json @@ -1,12 +1,12 @@ { "name": "@winglibs/postgres", - "version": "0.1.4", + "version": "0.1.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@winglibs/postgres", - "version": "0.1.4", + "version": "0.1.5", "license": "MIT", "peerDependencies": { "@cdktf/provider-aws": "^19.12.0", diff --git a/postgres/package.json b/postgres/package.json index 0fde05db..fdab5362 100644 --- a/postgres/package.json +++ b/postgres/package.json @@ -1,6 +1,6 @@ { "name": "@winglibs/postgres", - "version": "0.1.5", + "version": "0.1.6", "description": "Postgres support for Wing", "repository": { "type": "git",