#include "remoting/base/service_urls.h"
#include "base/check.h"
#include "base/command_line.h"
#include "base/logging.h"
#if defined(NDEBUG)
constexpr char kFtlServerEndpoint[] = "instantmessaging-pa.googleapis.com";
constexpr char kRemotingServerEndpoint[] = "remotedesktop-pa.googleapis.com";
#else
constexpr char kFtlServerEndpoint[] =
"tachyon-playground-autopush-grpc.sandbox.googleapis.com";
constexpr char kRemotingServerEndpoint[] =
"autopush-remotedesktop-pa.sandbox.googleapis.com";
#endif
#if !defined(NDEBUG)
constexpr char kFtlServerEndpointSwitch[] = "ftl-server-endpoint";
constexpr char kRemotingServerEndpointSwitch[] = "remoting-server-endpoint";
#endif
namespace remoting {
ServiceUrls::ServiceUrls()
: ftl_server_endpoint_(kFtlServerEndpoint),
remoting_server_endpoint_(kRemotingServerEndpoint) {
#if !defined(NDEBUG)
if (base::CommandLine::InitializedForCurrentProcess()) {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
CHECK(command_line);
if (command_line->HasSwitch(kFtlServerEndpointSwitch)) {
ftl_server_endpoint_ =
command_line->GetSwitchValueASCII(kFtlServerEndpointSwitch);
} else {
LOG(WARNING) << "CRD: Using autopush (non prod) FTL server";
}
if (command_line->HasSwitch(kRemotingServerEndpointSwitch)) {
remoting_server_endpoint_ =
command_line->GetSwitchValueASCII(kRemotingServerEndpointSwitch);
} else {
LOG(WARNING) << "CRD: Using autopush (non prod) remoting server";
}
}
#endif
}
ServiceUrls::~ServiceUrls() = default;
ServiceUrls* remoting::ServiceUrls::GetInstance() {
return base::Singleton<ServiceUrls>::get();
}
}