Skip to content

Commit c1d23b1

Browse files
author
Mauricio Siu
committed
refactor: streamline command and args handling in Redis container configuration
- Updated the Redis container build function to simplify the handling of command and arguments. - Ensured default command and arguments are set when none are provided, improving robustness.
1 parent 272a8db commit c1d23b1

File tree

1 file changed

+14
-8
lines changed
  • packages/server/src/utils/databases

1 file changed

+14
-8
lines changed

packages/server/src/utils/databases/redis.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,20 @@ export const buildRedis = async (redis: RedisNested) => {
7373
Mounts: [...volumesMount, ...bindsMount, ...filesMount],
7474
...(StopGracePeriod !== null &&
7575
StopGracePeriod !== undefined && { StopGracePeriod }),
76-
...(command && {
77-
Command: command.split(" "),
78-
}),
79-
...(args &&
80-
args.length > 0 && {
81-
Args: args,
82-
}),
83-
76+
...(command || args
77+
? {
78+
...(command && {
79+
Command: command.split(" "),
80+
}),
81+
...(args &&
82+
args.length > 0 && {
83+
Args: args,
84+
}),
85+
}
86+
: {
87+
Command: ["/bin/sh"],
88+
Args: ["-c", `redis-server --requirepass ${databasePassword}`],
89+
}),
8490
Labels,
8591
},
8692
Networks,

0 commit comments

Comments
 (0)