Skip to content

Commit

Permalink
Use better docker image.
Browse files Browse the repository at this point in the history
MongoDB -> Enterprise
Redis (geohash mode) -> (raw) Redis
  • Loading branch information
kj415j45 committed Aug 10, 2023
1 parent 5b8ee0c commit 09a0ca6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
4 changes: 2 additions & 2 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/sh

# MongoDB
docker run -p 27017:27017 --name mongo -d mongodb/mongodb-community-server:latest
docker run -p 27017:27017 --name mongo -d mongodb/mongodb-enterprise-server:latest

# Redis
docker run -p 6379:6379 --name redisJson -d redis/redis-stack-server:latest
docker run -p 6380:6379 --name redisGeohash -d redis/redis-stack-server:latest
docker run -p 6380:6379 --name redisGeohash -d redis:latest
9 changes: 3 additions & 6 deletions src/Redis/RedisGeohash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import {
import { Latitude, Longitude } from "../utils";

export class RedisGeohash extends TestDatabase {
uri?: string;
uri: string;
redis: ReturnType<typeof createClient>;

constructor(uri?: string) {
super();
this.uri = uri;
this.uri = uri ?? "redis://127.0.0.1:6380";
this.redis = createClient({
url: uri ?? this.uri ?? "redis://127.0.0.1:6380",
url: this.uri,
});
}

Expand All @@ -24,9 +24,6 @@ export class RedisGeohash extends TestDatabase {
}

async connect(uri?: string | undefined): Promise<void> {
this.redis = createClient({
url: uri ?? this.uri ?? "redis://localhost:6379/",
});
await this.redis.connect();
}

Expand Down
9 changes: 3 additions & 6 deletions src/Redis/RedisJson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import { transformLocationJson, transformTestDataJson } from "./Transformer";
import distance from "@turf/distance";

export class RedisJson extends TestDatabase {
uri?: string;
uri: string;
redis: ReturnType<typeof createClient>;
repository?: Repository;

constructor(uri?: string) {
super();
this.uri = uri;
this.uri = uri ?? "redis://localhost:6379/";
this.redis = createClient({
url: uri ?? this.uri ?? "redis://localhost:6379/",
url: this.uri,
});
}

Expand All @@ -25,9 +25,6 @@ export class RedisJson extends TestDatabase {
}

async connect(uri?: string | undefined): Promise<void> {
this.redis = createClient({
url: uri ?? this.uri ?? "redis://localhost:6379/",
});
await this.redis.connect();
this.repository = new Repository(locationSchema, this.redis);
}
Expand Down

0 comments on commit 09a0ca6

Please sign in to comment.