Skip to content
This repository was archived by the owner on Mar 29, 2024. It is now read-only.

Commit 6608b85

Browse files
committed
Merge branch 'mongodb'
2 parents b04a850 + 8c12039 commit 6608b85

18 files changed

+1012
-327
lines changed

.travis.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,29 @@ node_js:
55
- '5'
66
- '4'
77
- '0.12'
8+
services:
9+
- mongodb
810
before_install:
911
- npm install -g frisby
1012
- npm install -g jasmine-node
13+
- npm install -g underscore
14+
- npm install -g pow-mongodb-fixtures
1115
- ./generate_ssl.sh
1216
before_script:
17+
- mongofixtures test fixtures
1318
- npm start &
1419
- sleep 5
1520
after_script:
1621
- process.exit()
1722
env:
18-
- NODE_ENV=testing
23+
- NODE_ENV=testing-config
24+
- NODE_ENV=testing-mongodb
25+
- NODE_ENV=testing-fallback
26+
matrix:
27+
exclude:
28+
- node_js: '6'
29+
env: NODE_ENV=testing-fallback
30+
- node_js: '5'
31+
env: NODE_ENV=testing-fallback
32+
- node_js: '0.12'
33+
env: NODE_ENV=testing-fallback

CONTRIBUTION.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,31 @@ For testing you will need FrisbyJs and Jasmine:
66

77
npm install -g frisby
88
npm install -g jasmine-node
9+
npm install pow-mongodb-fixtures -g
10+
npm install -g underscore
11+
12+
Note: Underscore is required because of an issue in the dependencies of mongodb-fixtures.
913

1014
## Running the tests
1115

1216
First, start the server in testing mode:
1317

14-
NODE_ENV=testing node app.js
18+
NODE_ENV=testing-config node app.js
19+
20+
(Re)populate the testing Mongodb database:
21+
22+
mongo test --eval \"db.dropDatabase()\"
23+
mongofixtures test fixtures
1524

1625
Then the tests:
1726

18-
NODE_ENV=testing jasmine-node test
27+
NODE_ENV=testing-config jasmine-node test
1928

20-
All tests must pass.
29+
All tests must pass. You have to repeat the steps above for all environments:
30+
31+
* testing-config
32+
* testing-mongodb
33+
* testing-fallback
2134

2235
## Misc dev notes
2336

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ However, Mjölnir is developed for replacing the authentication system of Minecr
1111

1212
Features (planned):
1313

14-
- Own users database
1514
- Backup authentication server (in proxy mode)
1615
- Rate limit
1716

config/default.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@
3131
"commonName": "apiserver.mojang.com"
3232
}
3333
},
34-
"drivers": ["config"],
34+
"drivers": ["config", "mongodb"],
35+
"mongodb": {
36+
"connectionStr": "mongodb://localhost:27017/mjolnir"
37+
},
3538
"users": [
3639
]
3740
}

config/testing.json renamed to config/testing-config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@
3434
"accessToken": "d41d8cd98f00b204e9800998ecf8427e",
3535
"lastLogin": "2015-04-23T18:25:43.511Z"
3636
}
37-
]
37+
],
38+
"drivers": ["config"]
3839
}

config/testing-fallback.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"serverOwner": "Tester",
3+
"timestampFormat": "YYYY-MM-DD HH:mm:ss| ",
4+
"hashAlgorithm": "md5",
5+
"secret": "test-token",
6+
"authserver": {
7+
"httpPort": 6666,
8+
"httpsPort": 6667
9+
},
10+
"sessionserver": {
11+
"httpPort": 6677,
12+
"httpsPort": 6678
13+
},
14+
"apiserver": {
15+
"httpPort": 6688,
16+
"httpsPort": 6689
17+
},
18+
"users": [
19+
{
20+
"id": "650bed2c-9ef5-4b5f-b02c-61fa493c68b5",
21+
"username": "test",
22+
"password": "098f6bcd4621d373cade4e832627b4f6", // test using MD5
23+
"playerName": "testPlayer",
24+
"skinUrl": "steve.png"
25+
},
26+
{
27+
"id": "0e565137-f983-49fe-ac61-15adfe19e962",
28+
"username": "overlapUser",
29+
"password": "912ec803b2ce49e4a541068d495ab570", // asdf using MD5
30+
"playerName": "overlapPlayer",
31+
"playerNameIndex": "overlapplayer",
32+
"skinUrl": "steve.png"
33+
}
34+
],
35+
"drivers": ["config", "mongodb"],
36+
"mongodb": {
37+
"connectionStr": "mongodb://localhost:27017/test"
38+
}
39+
}

config/testing-mongodb.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"serverOwner": "Tester",
3+
"timestampFormat": "YYYY-MM-DD HH:mm:ss| ",
4+
"hashAlgorithm": "md5",
5+
"secret": "test-token",
6+
"authserver": {
7+
"httpPort": 6666,
8+
"httpsPort": 6667
9+
},
10+
"sessionserver": {
11+
"httpPort": 6677,
12+
"httpsPort": 6678
13+
},
14+
"apiserver": {
15+
"httpPort": 6688,
16+
"httpsPort": 6689
17+
},
18+
"users": [],
19+
"drivers": ["mongodb"],
20+
"mongodb": {
21+
"connectionStr": "mongodb://localhost:27017/test"
22+
}
23+
}

0 commit comments

Comments
 (0)