node-casbin/sequelize-adapter

Sequelize adapter not recognising ssl option when using postgres uri

apsnaidu opened this issue · 2 comments

When using a postgres URI for creating a new sequelize adapter I'm getting SSL connection is required. Please specify SSL options and retry..
Below is the syntax I'm using.

const { SequelizeAdapter } = require("casbin-sequelize-adapter");

sqladapter = await SequelizeAdapter.newAdapter(postgres://root@localhost:5432/testdb, {
          dialect: "postgres",
          schema: "automation",
          dialectOptions: {
            ssl: true,
          },
        });     

The adapter works fine when using username, password syntax.

   sqladapter = await SequelizeAdapter.newAdapter({
          host: "hostname",
          port: "5432",
          username: "root",
          password: "",
          database: "testdb",
          dialect: "postgres",
          schema: "automation",
          dialectOptions: {
            ssl: true,
          },
        });

"sequelize": "^5.22.3"
"casbin-sequelize-adapter": "^2.1.0"
"casbin": "^5.1.3"

/**
* newAdapter is the constructor.
* @param option sequelize connection option
*/
public static async newAdapter(
option: SequelizeOptions
): Promise<SequelizeAdapter> {

newAdapter only allows SequelizeOptions instead of string