Skip to content

Commit f2c6d7e

Browse files
committed
fix: detect database number for Heroku Redis
Close #55, #52
1 parent 9ecce73 commit f2c6d7e

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

README.md

+10
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ $ npm install
4040
$ npm run deploy
4141
```
4242

43+
## Connect to Heroku
44+
Medis can connect to Heroku Redis addon to manage your data. You just need to call `heroku redis:credentials --app APP` to get your redis credential:
45+
46+
```shell
47+
$ heroku redis:credentials --app YOUR_APP
48+
redis://x:PASSWORD@HOST:PORT
49+
```
50+
51+
And then input `HOST`, `PORT` and `PASSWORD` to the connection tab.
52+
4353
## I Love This. How do I Help?
4454

4555
* Simply star this repository :-)

client/components/main/Main/Database/KeyBrowser/Footer.jsx

+10-13
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,16 @@ class Footer extends React.Component {
2222

2323
updateDBCount() {
2424
this.props.redis.config('get', 'databases', (err, res) => {
25-
if (!err) {
26-
if (res[1]) {
27-
this.setState({ databases: Number(res[1]) });
28-
} else {
29-
const redis = this.props.redis.duplicate();
30-
const select = redis.select.bind(redis);
31-
this.guessDatabaseNumber(select, 15).then((count) => {
32-
console.log('===', count)
33-
return typeof count === 'number' ? count : this.guessDatabaseNumber(select, 1, 0);
34-
}).then((count) => {
35-
this.setState({ databases: count + 1 });
36-
});
37-
}
25+
if (!err && res[1]) {
26+
this.setState({ databases: Number(res[1]) });
27+
} else {
28+
const redis = this.props.redis.duplicate();
29+
const select = redis.select.bind(redis);
30+
this.guessDatabaseNumber(select, 15).then((count) => {
31+
return typeof count === 'number' ? count : this.guessDatabaseNumber(select, 1, 0);
32+
}).then((count) => {
33+
this.setState({ databases: count + 1 });
34+
});
3835
}
3936
});
4037
}

0 commit comments

Comments
 (0)