// TODO: Build a real services.xml for windows development.
//       and remove the base_url logic below.
std::string LLServiceBuilder::buildServiceURI(const std::string& service_name) const
{
	std::ostringstream service_url;
	// Find the service builder
	std::map<std::string, std::string>::const_iterator it =
		mServiceMap.find(service_name);
	if(it != mServiceMap.end())
	{
		// construct the service builder url
		LLApp* app = LLApp::instance();
		if(app)
		{
			// We define a base-url for some development configurations
			// In production neither of these are defined and all services have full urls
			LLSD base_url;

			if (starts_with(service_name,"cap"))
			{
				base_url = app->getOption("cap-base-url");
			}

			if (base_url.asString().empty())
			{
				base_url = app->getOption("services-base-url");
			}
			service_url << base_url.asString();
		}
		service_url << it->second;
	}
	else
	{
		llwarns << "Cannot find service " << service_name << llendl;
	}
	return service_url.str();
}
Ejemplo n.º 2
0
// virtual 
bool LLLiveAppConfig::loadFile()
{
	LL_INFOS() << "LLLiveAppConfig::loadFile(): reading from "
		<< filename() << LL_ENDL;
    llifstream file(filename().c_str());
	LLSD config;
    if (file.is_open())
    {
        LLSDSerialize::fromXML(config, file);
		if(!config.isMap())
		{
			LL_WARNS() << "Live app config not an map in " << filename()
				<< " Ignoring the data." << LL_ENDL;
			return false;
		}
		file.close();
    }
	else
	{
		LL_INFOS() << "Live file " << filename() << " does not exit." << LL_ENDL;
	}
	// *NOTE: we do not handle the else case here because we would not
	// have attempted to load the file unless LLLiveFile had
	// determined there was a reason to load it. This only happens
	// when either the file has been updated or it is either suddenly
	// in existence or has passed out of existence. Therefore, we want
	// to set the config to an empty config, and return that it
	// changed.

	LLApp* app = LLApp::instance();
	if(app) app->setOptionData(mPriority, config);
	return true;
}
Ejemplo n.º 3
0
	virtual LLSD simpleGet() const
	{
		LLSD result;
		LLApp* app = LLApp::instance();
		for(int ii = 0; ii < LLApp::PRIORITY_COUNT; ++ii)
		{
			result.append(app->getOptionData((LLApp::OptionPriority)ii));
		}
		return result;
	}
Ejemplo n.º 4
0
	virtual void get(
		LLHTTPNode::ResponsePtr response,
		const LLSD& context) const
	{
		LLSD result;
		LLApp* app = LLApp::instance();
		LLSD::map_const_iterator iter;
		LLSD::map_const_iterator end;
		for(int ii = LLApp::PRIORITY_COUNT - 1; ii >= 0; --ii)
		{
			LLSD options = app->getOptionData((LLApp::OptionPriority)ii);
			iter = options.beginMap();
			end = options.endMap();
			for(; iter != end; ++iter)
			{
				result[(*iter).first] = (*iter).second;
			}
		}
		response->result(result);
	}
Ejemplo n.º 5
0
//@brief Function to check if specified legacy log message should be sent.
bool LLLogImpl::useLegacyLogMessage(const std::string &message)
{
    LLSD log_config = mApp->getOption("log-messages");
	if (log_config.has(message))
	{
		LLSD message_config = log_config[message];
		if (message_config.has("use-legacy"))
		{
			return message_config["use-legacy"].asBoolean();
		}
	}
	return true;
}
Ejemplo n.º 6
0
//@brief Function to log a message to syslog for streambase to collect.
void LLLogImpl::log(const std::string message, LLSD& info)
{
	static S32 sequence = 0;
    LLSD log_config = mApp->getOption("log-messages");
	if (log_config.has(message))
	{
		LLSD message_config = log_config[message];
		if (message_config.has("use-syslog"))
		{
			if (! message_config["use-syslog"].asBoolean())
			{
				return;
			}
		}
	}
	llinfos << "LLLOGMESSAGE (" << (sequence++) << ") " << message << " " << LLSDNotationStreamer(info) << llendl;
}