Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible mistake in documentation #239

Closed
kevingeorget opened this issue Nov 19, 2022 · 1 comment
Closed

Possible mistake in documentation #239

kevingeorget opened this issue Nov 19, 2022 · 1 comment

Comments

@kevingeorget
Copy link

kevingeorget commented Nov 19, 2022

Hello,

First of all thank you for this Knex adapter.

It seems there is an error in the documentation example.
const adapter = await KnexAdapter.newAdapter({ knex }); should be replaced by
const adapter = await KnexAdapter.newAdapter(knex);

This PR fixes the problem: #240

@transtone
Copy link

transtone commented Feb 4, 2023

thx kevingeorget

import Knex from 'knex'
import { KnexAdapter } from 'casbin-knex-adapter'

const knex = Knex({
    client: 'pg',
    connection: {
      host: process.env.PG_HOST,
      port: Number(process.env.PG_PORT),
      user: process.env.PG_USERNAME,
      password: process.env.PG_PASSWORD,
      database: process.env.PG_DATABASE,
    },
  })
const a = await KnexAdapter.newAdapter(knex)
const e = await newEnforcer('modal.conf path', a)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants