Skip to content

Commit b5404dd

Browse files
committed
add error
1 parent f813f3c commit b5404dd

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

components/neon_api_keys/neon_api_keys.app.mjs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,35 @@ export default {
5252
},
5353
methods: {
5454
...postgresql.methods,
55+
_hasDbCredentials() {
56+
return this.$auth.host
57+
&& this.$auth.port
58+
&& this.$auth.user
59+
&& this.$auth.password
60+
&& this.$auth.database;
61+
},
62+
getClientConfiguration() {
63+
if (!this._hasDbCredentials()) {
64+
throw new Error("No database credentials found");
65+
}
66+
67+
const {
68+
host,
69+
port,
70+
user,
71+
password,
72+
database,
73+
} = this.$auth;
74+
75+
return {
76+
host,
77+
port,
78+
user,
79+
password,
80+
database,
81+
ssl: this._getSslConfig(),
82+
};
83+
},
5584
_apiKey() {
5685
return this.$auth.api_key;
5786
},

0 commit comments

Comments
 (0)