/osjsv3-db-auth-example

Primary LanguageJavaScriptOtherNOASSERTION

OS.js Logo

OS.js v3 Database Auth Docker Example

This example runs on docker and demonstrates the database authentication adapter.

Support Back Sponsor Donate Donate Community

Installation

Uses the official distribution template and runs on http://localhost:8000 by default.

Setup

After the first time you've run this setup procedure you can simply use docker-compose up and skip the steps below.

Database

First set up database:

docker-compose up db
echo "CREATE DATABASE osjsv3;" | docker-compose exec db mysql -uroot -psecret
echo "CREATE USER 'osjsv3'@'localhost' IDENTIFIED BY 'secret';" | docker-compose exec db mysql -uroot -psecret
echo "GRANT ALL ON osjsv3.* TO 'osjsv3'@'localhost';" | docker-compose exec db mysql -uroot -psecret

Instance

Then start OS.js:

Note that the first time this is run it might take a while.

docker-compose up

Add users

Now you can add users (you will get prompted for a password):

docker-compose exec osjs npx osjs-cli user:add --username=name --groups=admin

Contribution

Documentation

See the Official Manuals for articles, tutorials and guides.

Links