Skip to content

Commit

Permalink
Adds documentation for async knex (#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
flovilmart committed Mar 24, 2020
1 parent 85b4c79 commit f89f6b7
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions sections/migrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,32 @@ export default [
};
`
},
{
type: "text",
size: "sm",
content: "you can also export an async function from the knexfile. This is useful when you need to fetch credentials from a secure location like vault"
},
{
type: "code",
language: "js",
content: `
async function fetchConfiguration() {
// TODO: implement me
return {
client: 'pg',
connection: { user: 'me', password: 'my_pass' }
}
}
module.exports = async () => {
const configuration = await fetchConfiguration();
return {
...configuration,
migrations: {}
}
};
`
},
{
type: "heading",
size: "sm",
Expand Down

0 comments on commit f89f6b7

Please sign in to comment.