Add optionally-include configuration directive.

This commit is contained in:
Yossi Gottlieb
2012-12-23 16:38:00 +02:00
parent 5430513dbb
commit 1dac827634
3 changed files with 10 additions and 0 deletions
+2
View File
@@ -45,6 +45,8 @@ load-on-startup
even if they exist. This is useful on slaves that would immediately need
to replicate from masters anyway.
optionally-include
Works like 'include' but silently ignores non-existing files.
Additional Statistics
---------------------
+2
View File
@@ -549,3 +549,5 @@ client-output-buffer-limit pubsub 32mb 8mb 60
#
# include /path/to/local.conf
# include /path/to/other.conf
# optionally-include /path/to/optional-file.conf
+6
View File
@@ -184,6 +184,12 @@ void loadServerConfigFromString(char *config) {
}
} else if (!strcasecmp(argv[0],"include") && argc == 2) {
loadServerConfig(argv[1],NULL);
} else if (!strcasecmp(argv[0],"optionally-include") && argc == 2) {
FILE *tmp = fopen(argv[1], "r");
if (tmp != NULL) {
fclose(tmp);
loadServerConfig(argv[1],NULL);
}
} else if (!strcasecmp(argv[0],"maxclients") && argc == 2) {
server.maxclients = atoi(argv[1]);
if (server.maxclients < 1) {