Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
f62851ae
Commit
f62851ae
authored
May 13, 2013
by
antirez
Browse files
CONFIG REWRITE: support for dir and slaveof.
parent
91ef10ef
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/config.c
View file @
f62851ae
...
@@ -1306,9 +1306,21 @@ void rewriteConfigSaveOption(struct rewriteConfigState *state) {
...
@@ -1306,9 +1306,21 @@ void rewriteConfigSaveOption(struct rewriteConfigState *state) {
}
}
void
rewriteConfigDirOption
(
struct
rewriteConfigState
*
state
)
{
void
rewriteConfigDirOption
(
struct
rewriteConfigState
*
state
)
{
char
cwd
[
1024
];
if
(
getcwd
(
cwd
,
sizeof
(
cwd
))
==
NULL
)
return
;
/* no rewrite on error. */
rewriteConfigStringOption
(
state
,
"dir"
,
cwd
,
NULL
);
}
}
void
rewriteConfigSlaveofOption
(
struct
rewriteConfigState
*
state
)
{
void
rewriteConfigSlaveofOption
(
struct
rewriteConfigState
*
state
)
{
sds
line
;
/* If this is a master, we want all the slaveof config options
* in the file to be removed. */
if
(
server
.
masterhost
==
NULL
)
return
;
line
=
sdscatprintf
(
sdsempty
(),
"slaveof %s %d"
,
server
.
masterhost
,
server
.
masterport
);
rewriteConfigRewriteLine
(
state
,
"slaveof"
,
line
,
1
);
}
}
void
rewriteConfigAppendonlyOption
(
struct
rewriteConfigState
*
state
)
{
void
rewriteConfigAppendonlyOption
(
struct
rewriteConfigState
*
state
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment