* Creates a PlanetScale connection object and returns it. * @param {{DATABASE_HOST: string, DATABASE_USERNAME: string, DATABASE_PASSWORD: string}} env The environment variables containing the database connection information. * @returns {Promise } A Promise that resolves to the PlanetScale
(env)
| 149 | * @returns {Promise<object>} A Promise that resolves to the PlanetScale connection object. |
| 150 | */ |
| 151 | function getPlanetScaleConnection(env) { |
| 152 | const config = { |
| 153 | host: env.DATABASE_HOST, |
| 154 | username: env.DATABASE_USERNAME, |
| 155 | password: env.DATABASE_PASSWORD, |
| 156 | fetch: (url, init) => { |
| 157 | delete (init)["cache"]; |
| 158 | return fetch(url, init); |
| 159 | } |
| 160 | } |
| 161 | return connectdb(config) |
| 162 | } |
| 163 | |
| 164 | /** |
| 165 | * Handles VLESS over WebSocket requests by creating a WebSocket pair, accepting the WebSocket connection, and processing the VLESS header. |