Skip to content

Instantly share code, notes, and snippets.

@koistya
Last active September 5, 2020 22:02
Show Gist options
  • Save koistya/91127036d9cc6fd59314db6736fd4514 to your computer and use it in GitHub Desktop.
Save koistya/91127036d9cc6fd59314db6736fd4514 to your computer and use it in GitHub Desktop.
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