-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #99 from ohkinozomu/mysql-docker-compose
Add Docker Compose for MySQL testing
- Loading branch information
Showing
7 changed files
with
75 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
services: | ||
mysql: | ||
image: mysql:8.0 | ||
container_name: mysql | ||
environment: | ||
MYSQL_ROOT_PASSWORD: 12345678 | ||
MYSQL_DATABASE: comqtt | ||
ports: | ||
- "3306:3306" | ||
command: --character-set-server=utf8 --collation-server=utf8_general_ci | ||
volumes: | ||
- ./plugin/auth/mysql/testdata/init.sql:/docker-entrypoint-initdb.d/init.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ import ( | |
"crypto/sha512" | ||
"encoding/base64" | ||
"encoding/hex" | ||
|
||
"golang.org/x/crypto/bcrypt" | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
BEGIN; | ||
|
||
CREATE TABLE auth ( | ||
id INT AUTO_INCREMENT PRIMARY KEY, | ||
username VARCHAR(255) NOT NULL UNIQUE, | ||
password VARCHAR(255) NOT NULL, | ||
allow SMALLINT DEFAULT 1 NOT NULL, | ||
created TIMESTAMP DEFAULT CURRENT_TIMESTAMP, | ||
updated TIMESTAMP NULL | ||
); | ||
|
||
CREATE TABLE acl ( | ||
id INT AUTO_INCREMENT PRIMARY KEY, | ||
username VARCHAR(255) NOT NULL, | ||
topic VARCHAR(255) NOT NULL, | ||
access SMALLINT DEFAULT 3 NOT NULL, | ||
created TIMESTAMP DEFAULT CURRENT_TIMESTAMP, | ||
updated TIMESTAMP NULL | ||
); | ||
|
||
CREATE INDEX acl_username_idx ON acl(username); | ||
|
||
-- 123456 | ||
INSERT INTO auth (username, password, allow) VALUES ('zhangsan', '$2a$12$j8bs10UCRC5GUENPqZXLceACpN1l72wcDaN6F0j0rIbcHIZpt0Cbq', 1); | ||
INSERT INTO acl (username, topic, access) VALUES ('zhangsan', 'topictest/1', 2); | ||
|
||
COMMIT; |