MCPcopy Index your code
hub / github.com/scality/cloudserver / parseRedisConfig

Function parseRedisConfig

lib/Config.js:123–162  ·  view source on GitHub ↗
(redisConfig)

Source from the content-addressed store, hash-verified

121}
122
123function parseRedisConfig(redisConfig) {
124 const joiSchema = joi.object({
125 password: joi.string().allow(''),
126 host: joi.string(),
127 port: joi.number(),
128 retry: joi.object({
129 connectBackoff: joi.object({
130 min: joi.number().required(),
131 max: joi.number().required(),
132 jitter: joi.number().required(),
133 factor: joi.number().required(),
134 deadline: joi.number().required(),
135 }),
136 }),
137 // sentinel config
138 sentinels: joi.alternatives().try(
139 joi.string()
140 .pattern(/^[a-zA-Z0-9.-]+:[0-9]+(,[a-zA-Z0-9.-]+:[0-9]+)*$/)
141 .custom(hosts => hosts.split(',').map(item => {
142 const [host, port] = item.split(':');
143 return { host, port: Number.parseInt(port, 10) };
144 })),
145 joi.array().items(
146 joi.object({
147 host: joi.string().required(),
148 port: joi.number().required(),
149 })
150 ).min(1),
151 ),
152 name: joi.string(),
153 sentinelPassword: joi.string().allow(''),
154 })
155 .and('host', 'port')
156 .and('sentinels', 'name')
157 .xor('host', 'sentinels')
158 .without('sentinels', ['host', 'port'])
159 .without('host', ['sentinels', 'sentinelPassword']);
160
161 return joi.attempt(redisConfig, joiSchema, 'bad config');
162}
163
164function parseSupportedLifecycleRules(supportedLifecycleRulesConfig) {
165 const supportedLifecycleRulesSchema = joi.array()

Callers 3

parseUtapiReindexFunction · 0.85
_getConfigMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected