From 6e7cb9b3323311334b822f9dd585a47ab795f472 Mon Sep 17 00:00:00 2001 From: Anton Voylenko Date: Thu, 23 Mar 2023 21:44:45 +0200 Subject: [PATCH] update README (#129) --- README.md | 8 +++++--- db/create-admin-user.sql | 10 ++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 db/create-admin-user.sql diff --git a/README.md b/README.md index 25dd238..d6fd851 100644 --- a/README.md +++ b/README.md @@ -15,15 +15,17 @@ JAMBONES_MYSQL_CONNECTION_LIMIT # defaults to 10 JAMBONES_REDIS_HOST JAMBONES_REDIS_PORT JAMBONES_LOGLEVEL # defaults to info -JAMBONES_API_VERSION # defaults to v1 +JAMBONES_API_VERSION # defaults to v1 +JAMBONES_TIME_SERIES_HOST +JWT_SECRET HTTP_PORT # defaults to 3000 ``` #### Database dependency A mysql database is used to store long-lived objects such as Accounts, Applications, etc. To create the database schema, use or review the scripts in the 'db' folder, particularly: -- [create_db.sql](db/create_db.sql), which creates the database and associated user (you may want to edit the username and password), - [jambones-sql.sql](db/jambones-sql.sql), which creates the schema, -- [create-admin-token.sql](db/create-admin-token.sql), which creates an admin-level auth token that can be used for testing/exercising the API. +- [seed-production-database-open-source.sql](db/seed-production-database-open-source.sql), which seeds the database with initial dataset(accounts, permissions, api keys, applications etc). +- [create-admin-user.sql](db/create-admin-user.sql), which creates admin user with password set to "admin". The password will be forced to change after the first login. > Note: due to the dependency on the npmjs [mysql](https://www.npmjs.com/package/mysql) package, the mysql database must be configured to use sql [native authentication](https://medium.com/@crmcmullen/how-to-run-mysql-8-0-with-native-password-authentication-502de5bac661). diff --git a/db/create-admin-user.sql b/db/create-admin-user.sql new file mode 100644 index 0000000..f2c266e --- /dev/null +++ b/db/create-admin-user.sql @@ -0,0 +1,10 @@ +/* hashed password is "admin" */ +insert into users (user_sid, name, email, hashed_password, force_change, provider, email_validated) +values ('12c80508-edf9-4b22-8d09-55abd02648eb', 'admin', 'joe@foo.bar', '$argon2i$v=19$m=65536,t=3,p=4$c2FsdHNhbHRzYWx0c2FsdA$x5OO6gXFXS25oqUU2JvbYqrSgRxBujNUJBq6xv9EgjM', 1, 'local', 1); + +insert into user_permissions (user_permissions_sid, user_sid, permission_sid) +values ('8919e0dc-4d69-4de5-be56-a121598d9093', '12c80508-edf9-4b22-8d09-55abd02648eb', 'ffbc342a-546a-11ed-bdc3-0242ac120002'); +insert into user_permissions (user_permissions_sid, user_sid, permission_sid) +values ('d6fdf064-0a65-4b17-8b10-5500e956a159', '12c80508-edf9-4b22-8d09-55abd02648eb', 'ffbc3a10-546a-11ed-bdc3-0242ac120002'); +insert into user_permissions (user_permissions_sid, user_sid, permission_sid) +values ('f68185dd-0486-4767-a77d-a0b84c1b236e' ,'12c80508-edf9-4b22-8d09-55abd02648eb', 'ffbc3c5e-546a-11ed-bdc3-0242ac120002'); \ No newline at end of file