Last active
September 5, 2020 22:02
-
-
Save koistya/91127036d9cc6fd59314db6736fd4514 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fs from "fs"; | |
import knex from "knex"; | |
import env from "./env"; | |
export default knex({ | |
client: "pg", | |
connection: { | |
ssl: env.PGSSLMODE === "verify-ca" && { | |
cert: fs.readFileSync(env.PGSSLCERT, "ascii"), | |
key: fs.readFileSync(env.PGSSLKEY, "ascii"), | |
ca: fs.readFileSync(env.PGSSLROOTCERT, "ascii"), | |
servername: env.PGSERVERNAME, | |
}, | |
}, | |
// Cloud Functions limits concurrent executions to 1 per instance. You never | |
// have a situation where a single function instance is processing two | |
// requests at the same time. In most situations, only a single database | |
// connection is needed. | |
pool: { | |
min: 0, | |
max: 1, | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment