/**
 * Parse the CauchoHosts configuration in the apache config file.
 */
static const char *
resin_config_server_command(cmd_parms *cmd, void *pconfig,
			    const char *host_arg, const char *port_arg)
{
  config_t *config = pconfig; /* cse_get_server_config(cmd->server); */
  int port = port_arg ? atoi(port_arg) : DEFAULT_PORT;
  
  if (! config)
    return 0;

  config->has_config = 1;

  /*
  cse_add_host(&config->config_cluster, host_arg, port);
  */
  if (! strcmp(host_arg, "current")) {
    char hostname[256];
    
    gethostname(hostname, sizeof(hostname));
    host_arg = strdup(host_arg);
  }
  
  cse_add_config_server(config->p, config, host_arg, port);

  return 0;
}
Esempio n. 2
0
/**
 * Parse the ResinConfigServer configuration in the apache config file.
 */
static const char *
cse_config_server_command(cmd_parms *cmd, void *mconfig,
			  char *host_arg, char *port_arg)
{
  config_t *config = cse_get_cmd_config(cmd);
  int port = port_arg ? atoi(port_arg) : DEFAULT_PORT;

  /*
  cse_add_host(&config->config_cluster, host_arg, port);
  */
  cse_add_config_server(config, host_arg, port);

  return 0;
}
Esempio n. 3
0
static void
findResinIni(char *pwd, config_t *config)
{
	char resinIni[1024];

	sprintf(resinIni, "%s/resin.ini", pwd);

	LOG(("%s as resinIni\n", resinIni));

	FILE *file = fopen(resinIni, "r");

	if (file) {
		int found = parseResinIni(file, config);
		fclose(file);
		if (found)
			return;
	}
	else
	  config->enable_caucho_status = 1;

	cse_add_config_server((mem_pool_t *) config->p, config, "localhost", 6800);
}
Esempio n. 4
0
static int
parseResinIni(FILE *file, config_t *config)
{
	char key[1024];
	int has_host = 0;

	while (! feof(file)) {
		int ch;
		int i = 0;

		for (ch = fgetc(file); ch > 0 && ! isspace(ch); ch = fgetc(file))
			key[i++] = ch;
		key[i] = 0;
			
		for (; ch == ' ' || ch == '\t'; ch = fgetc(file)) {
		}

		if (! strcmp(key, "ResinConfigServer")) {
		  char host[1024];
		  int port;
		  
		  i = 0;
		  for (; ch > 0 && ! isspace(ch); ch = fgetc(file)) {
		    host[i++] = ch;
		  }
		  host[i] = 0;

		  for (; ch == ' ' || ch == '\t'; ch = fgetc(file)) {
		  }
		  
		  port = 0;
		  for (; ch >= '0' && ch <= '9'; ch = fgetc(file))
			port = port * 10 + ch - '0';

		  if (port == 0)
		    port = 6800;

		  /*
		  cse_add_host(&config->config_cluster, host, port);
		  */
		  cse_add_config_server((mem_pool_t *) config->p, config, host, port);

		  has_host = 1;
		}
		else if (! strcmp(key, "IISPriority")) {
		  char priority[1024];
		  
		  i = 0;
		  for (; ch > 0 && ch != ' ' && ch != '\t' && ch != '\n';
		       ch = fgetc(file))
			priority[i++] = ch;
		  priority[i] = 0;

		  config->iis_priority = strdup(priority);
		}
		else if (! strcmp(key, "OverrideIISAuthentication")) {
		  char status[1024];
		  
		  i = 0;
		  for (; ch > 0 && ch != ' ' && ch != '\t' && ch != '\n';
		       ch = fgetc(file))
			status[i++] = ch;
		  status[i] = 0;

		  if (! strcmp(status, "yes") || ! strcmp(status, "true"))
		    config->override_iis_authentication = 1;
		}
		else if (! strcmp(key, "CauchoStatus")) {
		  char status[1024];
		  
		  i = 0;
		  for (; ch > 0 && ch != ' ' && ch != '\t' && ch != '\n';
		       ch = fgetc(file))
			status[i++] = ch;
		  status[i] = 0;

		  if (! strcmp(status, "yes") || ! strcmp(status, "true"))
		    config->enable_caucho_status = 1;
		}
		
		for (; ch > 0 && ch != '\n'; ch = fgetc(file)) {
		}
	}

	return has_host;
}