You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16-2
Original file line number
Diff line number
Diff line change
@@ -43,7 +43,6 @@ await sql`
43
43
You can use either a `postgres://` url connection string or the options to define your database connection properties. Options in the object will override any present in the url.
More info for the `ssl` option can be found in the [Node.js docs for tls connect options](https://nodejs.org/dist/latest-v10.x/docs/api/tls.html#tls_new_tls_tlssocket_socket_options)
75
73
74
+
### Environment Variables for Options
75
+
76
+
It is also possible to connect to the database without a connection string or options, which will read the options from the environment variables in the table below:
77
+
78
+
```js
79
+
constsql=postgres()
80
+
```
81
+
82
+
| Option | Environment Variables |
83
+
| ---------- | ------------------------ |
84
+
|`host`|`PGHOST`|
85
+
|`port`|`PGPORT`|
86
+
|`database`|`PGDATABASE`|
87
+
|`username`|`PGUSERNAME` or `PGUSER`|
88
+
|`password`|`PGPASSWORD`|
89
+
76
90
## Query ```sql` ` -> Promise```
77
91
78
92
A query will always return a `Promise` which resolves to a results array `[...]{ rows, command }`. Destructuring is great to immediately access the first element.
0 commit comments