()
| 41 | }; |
| 42 | |
| 43 | export const resolveConnectionString = () => { |
| 44 | // Production should always use Hyperdrive when the binding exists. Keeping |
| 45 | // DATABASE_URL as a higher-priority fallback made it too easy for a deployed |
| 46 | // secret to silently bypass Hyperdrive. |
| 47 | if (env.EXECUTOR_DIRECT_DATABASE_URL === "true" && env.DATABASE_URL) { |
| 48 | return env.DATABASE_URL; |
| 49 | } |
| 50 | return env.HYPERDRIVE?.connectionString || env.DATABASE_URL || ""; |
| 51 | }; |
| 52 | |
| 53 | const makeSql = (): Sql => |
| 54 | postgres(resolveConnectionString(), { |
no outgoing calls
no test coverage detected