aboutsummaryrefslogtreecommitdiff
path: root/zenserver/upstream/jupiter.cpp
diff options
context:
space:
mode:
authorPer Larsson <[email protected]>2021-09-03 15:37:19 +0200
committerGitHub <[email protected]>2021-09-03 15:37:19 +0200
commitc04fa527593da17c719c4d899ec19caeb6480a94 (patch)
treefa65fd7585d55712bad546d76a0fc3518023a905 /zenserver/upstream/jupiter.cpp
parentoops: Fixed AssertException implementation namespace (diff)
downloadzen-c04fa527593da17c719c4d899ec19caeb6480a94.tar.xz
zen-c04fa527593da17c719c4d899ec19caeb6480a94.zip
Zen upstream support (#7)
Diffstat (limited to 'zenserver/upstream/jupiter.cpp')
-rw-r--r--zenserver/upstream/jupiter.cpp38
1 files changed, 16 insertions, 22 deletions
diff --git a/zenserver/upstream/jupiter.cpp b/zenserver/upstream/jupiter.cpp
index a59b9d317..7e22b9af9 100644
--- a/zenserver/upstream/jupiter.cpp
+++ b/zenserver/upstream/jupiter.cpp
@@ -52,7 +52,7 @@ namespace detail {
cpr::Session Session;
};
- void Log(spdlog::logger& Log, std::string_view Verb, const cpr::Response& Response)
+ static void Log(spdlog::logger& Log, std::string_view Verb, const cpr::Response& Response)
{
std::string_view ContentType = "unknown"sv;
if (auto It = Response.header.find("Content-Type"); It != Response.header.end())
@@ -299,24 +299,18 @@ CloudCacheAccessToken::SetToken(std::string_view Token)
// OAuthSecret: -GBWjjenhCgOwhxL5yBKNJECVIoDPH0MK4RDuN7d
//
-CloudCacheClient::CloudCacheClient(std::string_view ServiceUrl,
- std::string_view DdcNamespace,
- std::string_view BlobStoreNamespace,
- std::string_view OAuthProvider,
- std::string_view OAuthClientId,
- std::string_view OAuthSecret)
+CloudCacheClient::CloudCacheClient(const CloudCacheClientOptions& Options)
: m_Log(zen::logging::Get("jupiter"))
-, m_ServiceUrl(ServiceUrl)
-, m_OAuthFullUri(OAuthProvider)
-, m_DdcNamespace(DdcNamespace)
-, m_BlobStoreNamespace(BlobStoreNamespace)
-, m_DefaultBucket("default")
-, m_OAuthClientId(OAuthClientId)
-, m_OAuthSecret(OAuthSecret)
+, m_ServiceUrl(Options.ServiceUrl)
+, m_OAuthFullUri(Options.OAuthProvider)
+, m_DdcNamespace(Options.DdcNamespace)
+, m_BlobStoreNamespace(Options.BlobStoreNamespace)
+, m_OAuthClientId(Options.OAuthClientId)
+, m_OAuthSecret(Options.OAuthSecret)
{
- if (!OAuthProvider.starts_with("http://"sv) && !OAuthProvider.starts_with("https://"sv))
+ if (!Options.OAuthProvider.starts_with("http://"sv) && !Options.OAuthProvider.starts_with("https://"sv))
{
- m_Log.warn("bad provider specification: '{}' - must be fully qualified"_format(OAuthProvider).c_str());
+ m_Log.warn("bad provider specification: '{}' - must be fully qualified"_format(Options.OAuthProvider).c_str());
m_IsValid = false;
return;
@@ -324,28 +318,28 @@ CloudCacheClient::CloudCacheClient(std::string_view ServiceUrl,
// Split into host and Uri substrings
- auto SchemePos = OAuthProvider.find("://"sv);
+ auto SchemePos = Options.OAuthProvider.find("://"sv);
if (SchemePos == std::string::npos)
{
- m_Log.warn("Bad service URL passed to cloud cache client: '{}'", ServiceUrl);
+ m_Log.warn("Bad service URL passed to cloud cache client: '{}'", Options.ServiceUrl);
m_IsValid = false;
return;
}
- auto DomainEnd = OAuthProvider.find('/', /* also skip the :// */ SchemePos + 3);
+ auto DomainEnd = Options.OAuthProvider.find('/', /* also skip the :// */ SchemePos + 3);
if (DomainEnd == std::string::npos)
{
- m_Log.warn("Bad service URL passed to cloud cache client: '{}' no path delimiter found", ServiceUrl);
+ m_Log.warn("Bad service URL passed to cloud cache client: '{}' no path delimiter found", Options.ServiceUrl);
m_IsValid = false;
return;
}
- m_OAuthDomain = OAuthProvider.substr(SchemePos + 3, DomainEnd - SchemePos - 3); // epicgames.okta.com
- m_OAuthUriPath = OAuthProvider.substr(DomainEnd + 1); // oauth2/..../v1/token
+ m_OAuthDomain = Options.OAuthProvider.substr(SchemePos + 3, DomainEnd - SchemePos - 3); // epicgames.okta.com
+ m_OAuthUriPath = Options.OAuthProvider.substr(DomainEnd + 1); // oauth2/..../v1/token
}
CloudCacheClient::~CloudCacheClient()