christophertrudel / node_acl_knex

A Knex.js backend for node_acl
MIT License
46 stars 18 forks source link

Setup database does not work for postgresql #21

Open marcpre opened 6 years ago

marcpre commented 6 years ago

I am trying out node_acl. As you know, the package only supports reddis, mongodb etc.

I am starting with setting up my database like in your example (from the docs):

eg: node setup.js 'travis_ci_test', 'postgres', '12345', 'acl_'

My knex configurations look like the following and work fine with my current migrations & seeds:

    DB_CONNECTION=postgresql
    DB_ENV=development
    DB_USERNAME=root
    DB_PASSWORD=root
    DB_DATABASE=nodeacl

To run the setup I am trying to do the following command:

node setup.js 'nodeacl' , 'root' , '' , 'acl_'

node setup.js null, null, null, 'acl_', null, null, 'postgres://root:root@localhost:5432/nodeacl'

Find below my service configs from pgadmin

enter image description here enter image description here

When running the above commands I get the following error:

Possibly unhandled error: password authentication failed for user "theodore"
    at Connection.parseE (C:\Users\theodore\Desktop\Coding Projects\learning_npm_node_acl\node_modules\pg\lib\connection.js:546:11)
    at Connection.parseMessage (C:\Users\theodore\Desktop\Coding Projects\learning_npm_node_acl\node_modules\pg\lib\connection.js:371:19)
    at Socket.<anonymous> (C:\Users\theodore\Desktop\Coding Projects\learning_npm_node_acl\node_modules\pg\lib\connection.js:114:22)
    at emitOne (events.js:115:13)
    at Socket.emit (events.js:210:7)
    at addChunk (_stream_readable.js:266:12)
    at readableAddChunk (_stream_readable.js:253:11)
    at Socket.Readable.push (_stream_readable.js:211:10)
    at TCP.onread (net.js:585:20)

The funny thing is that I do not have a user theodore in my users:

enter image description here

Any suggestions what I am doing wrong?

I highly appreciate your replies!

Gredys commented 6 years ago

Dont write db-url at end. Working example: "node setup.js db_name user_name password prefix host port"