Received: by taz.hyperreal.com (8.8.4/V2.0) id QAA06225; Tue, 4 Mar 1997 16:10:58 -0800 (PST) Received: from sierra.zyzzyva.com by taz.hyperreal.com (8.8.4/V2.0) with ESMTP id QAA06095; Tue, 4 Mar 1997 16:10:46 -0800 (PST) Received: from sierra (localhost [127.0.0.1]) by sierra.zyzzyva.com (8.8.5/8.8.2) with ESMTP id SAA03418 for ; Tue, 4 Mar 1997 18:10:37 -0600 (CST) Message-Id: <199703050010.SAA03418@sierra.zyzzyva.com> X-Mailer: exmh version 2.0gamma 1/27/96 To: new-httpd@hyperreal.com Subject: Re: [Feature Suggestion] Config includes In-reply-to: jclary's message of Tue, 04 Mar 1997 14:45:04 -0800. <199703042046.OAA09404@futurefx.com> X-uri: http://www.zyzzyva.com/ Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 04 Mar 1997 18:10:37 -0600 From: Randy Terbush Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@hyperreal.com > > Does anyone else think it would be a good idea to add an include file > directive to the config system? I would like to have a set of > controlled administrative CGI's for my customers to change certain > aspects of the server config. The CGI's would handle format > and whatnot so as not to crash the server. Basically, it would > make it possible for the CGI's to avoid parsing and editing > the entire config, just selected portions. I have code that does this that has not made it in due to code freeze. Had I realized that we weren't in code freeze until this past weekend.... :) I'll include the function below. This can be passed a file or directory. IF passed a directory, it will recurse the directory structure looking for .htaccess files. My intent was to use this to have a separate configuration registry that used the filesystem for organization. > I could use resource config, but I'm already using that so my > httpd.conf doesn't get incredibly huge. I *had* a patch that let > me do this ages ago (1.0.5, I think) but I've changed companies > since then. > > Well, if this isn't too horribly difficult and its not > already there and just not documented. > > Basically it would be helpful if I could include EXTRA access config > and resource config info. > > If you think this is a good idea, I'll see about working up a patch > for 1.2 when I get some free time. > > --- > Jason S. Clary > http://www.futurefx.com/~jclary/ > --- Index: http_core.c =================================================================== RCS file: /export/home/cvs/apache/src/http_core.c,v retrieving revision 1.70 diff -c -r1.70 http_core.c *** http_core.c 1997/02/17 10:46:06 1.70 --- http_core.c 1997/03/05 00:09:32 *************** *** 820,825 **** --- 820,857 ---- return errmsg; } + const char *include_config (cmd_parms *cmd, void *dummy, char *name) + { + char *nname; + DIR *vdir; + struct DIR_TYPE *vdir_entry; + core_server_config *conf; + + + conf = get_module_config(cmd->server->module_config, &core_module); + + name = server_root_relative(cmd->pool, name); + + if ((vdir = opendir(name)) != NULL) { + while ((vdir_entry = readdir(vdir)) != NULL) { + if ((strcmp(vdir_entry->d_name, "..")) <= 0) + continue; + + nname = pstrcat(cmd->pool, name, vdir_entry->d_name, NULL); + + if (is_directory(nname)) + nname = pstrcat(cmd->pool, nname, "/", NULL); + + include_config(cmd, dummy, nname); + } + closedir(vdir); + } + else if ((strstr(name, conf->access_name)) != NULL) + process_resource_config(cmd->server, name, cmd->pool, cmd->temp_pool); + + return NULL; + } + const char *add_module_command (cmd_parms *cmd, void *dummy, char *arg) { if (add_named_module (arg)) *************** *** 1242,1247 **** --- 1274,1282 ---- { "Listen", set_listener, NULL, RSRC_CONF, TAKE1, "a port number or a numeric IP address and a port number"}, { "SendBufferSize", set_send_buffer_size, NULL, RSRC_CONF, TAKE1, "send buffer size in bytes"}, + { "IncludeConf", include_config, NULL, RSRC_CONF, RAW_ARGS, "configuration resource" }, { "AddModule", add_module_command, NULL, RSRC_CONF, ITERATE, "the name of a module" }, { "ClearModuleList", clear_module_list_command, NULL, RSRC_CONF, NO_ARGS, NULL },