@atomservice/redis 0.1.17 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/redis.compose.ts +6 -4
- package/src/redis.options.ts +4 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atomservice/redis",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.18",
|
|
4
4
|
"description": "Redis 原子服务",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "openorson",
|
|
@@ -27,6 +27,6 @@
|
|
|
27
27
|
".": "./src/index.ts"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@atomservice/core": "0.1.
|
|
30
|
+
"@atomservice/core": "0.1.18"
|
|
31
31
|
}
|
|
32
32
|
}
|
package/src/redis.compose.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { tmpl } from "@atomservice/core"
|
|
1
|
+
import { composeResourcesBlock, tmpl } from "@atomservice/core"
|
|
2
2
|
import { REDIS_CONF_PATH, REDIS_IMAGE } from "./redis.consts.ts"
|
|
3
3
|
import type { RedisOptions } from "./redis.options.ts"
|
|
4
4
|
|
|
@@ -7,9 +7,11 @@ export function redisCompose(
|
|
|
7
7
|
version: string,
|
|
8
8
|
dataDir: string,
|
|
9
9
|
confPath: string,
|
|
10
|
-
opts: Pick<RedisOptions, "password" | "hostPort">,
|
|
10
|
+
opts: Pick<RedisOptions, "password" | "hostPort" | "resources" | "restart">,
|
|
11
11
|
): string {
|
|
12
|
-
const { password, hostPort } = opts
|
|
12
|
+
const { password, hostPort, resources } = opts
|
|
13
|
+
const resourcesBlock = composeResourcesBlock(resources)
|
|
14
|
+
const restart = opts.restart ?? "unless-stopped"
|
|
13
15
|
|
|
14
16
|
const portsBlock = hostPort ? `\n ports:\n - "${hostPort}:6379"` : ""
|
|
15
17
|
const authEnv = password ? `\n environment:\n - REDISCLI_AUTH=${password}` : ""
|
|
@@ -25,7 +27,7 @@ services:
|
|
|
25
27
|
- ${confPath}:${REDIS_CONF_PATH}:ro${portsBlock}
|
|
26
28
|
networks:
|
|
27
29
|
- atomservice
|
|
28
|
-
restart:
|
|
30
|
+
restart: ${restart}${resourcesBlock}
|
|
29
31
|
healthcheck:
|
|
30
32
|
test: ["CMD", "redis-cli", "ping"]
|
|
31
33
|
interval: 10s
|
package/src/redis.options.ts
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* - 用于区分不同实例
|
|
6
|
-
*
|
|
7
|
-
* @default "default"
|
|
8
|
-
*/
|
|
9
|
-
id?: string
|
|
1
|
+
import type { BaseServiceOptions } from "@atomservice/core"
|
|
2
|
+
|
|
3
|
+
export interface RedisOptions extends BaseServiceOptions {
|
|
10
4
|
/**
|
|
5
|
+
|
|
11
6
|
* 镜像版本
|
|
12
7
|
*
|
|
13
8
|
* @default "8"
|