Ed Tanous | ba9f9a6 | 2017-10-11 16:40:35 -0700 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Ed Tanous | 3ccb3ad | 2023-01-13 17:40:03 -0800 | [diff] [blame] | 3 | #include "event_service_store.hpp" |
| 4 | #include "http_request.hpp" |
| 5 | #include "http_response.hpp" |
Ed Tanous | 2c6ffdb | 2023-06-28 11:28:38 -0700 | [diff] [blame] | 6 | #include "ossl_random.hpp" |
Ed Tanous | 3ccb3ad | 2023-01-13 17:40:03 -0800 | [diff] [blame] | 7 | #include "sessions.hpp" |
| 8 | |
Ed Tanous | 601c71a | 2021-09-08 16:40:12 -0700 | [diff] [blame] | 9 | #include <boost/beast/http/fields.hpp> |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 10 | #include <nlohmann/json.hpp> |
Ed Tanous | ba9f9a6 | 2017-10-11 16:40:35 -0700 | [diff] [blame] | 11 | |
Gunnar Mills | 1214b7e | 2020-06-04 10:11:30 -0500 | [diff] [blame] | 12 | #include <filesystem> |
James Feist | 3909dc8 | 2020-04-03 10:58:55 -0700 | [diff] [blame] | 13 | #include <fstream> |
Gunnar Mills | 1214b7e | 2020-06-04 10:11:30 -0500 | [diff] [blame] | 14 | #include <random> |
| 15 | |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 16 | namespace persistent_data |
| 17 | { |
Borawski.Lukasz | 9d8fd30 | 2018-01-05 14:56:09 +0100 | [diff] [blame] | 18 | |
Ed Tanous | 52cc112 | 2020-07-18 13:51:21 -0700 | [diff] [blame] | 19 | class ConfigFile |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 20 | { |
Ed Tanous | 271584a | 2019-07-09 16:24:22 -0700 | [diff] [blame] | 21 | uint64_t jsonRevision = 1; |
Ed Tanous | c963aa4 | 2017-10-27 16:00:19 -0700 | [diff] [blame] | 22 | |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 23 | public: |
Ratan Gupta | 845cb7d | 2019-07-12 00:32:25 +0530 | [diff] [blame] | 24 | // todo(ed) should read this from a fixed location somewhere, not CWD |
| 25 | static constexpr const char* filename = "bmcweb_persistent_data.json"; |
| 26 | |
Ed Tanous | 52cc112 | 2020-07-18 13:51:21 -0700 | [diff] [blame] | 27 | ConfigFile() |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 28 | { |
| 29 | readData(); |
Ed Tanous | c963aa4 | 2017-10-27 16:00:19 -0700 | [diff] [blame] | 30 | } |
Ed Tanous | c963aa4 | 2017-10-27 16:00:19 -0700 | [diff] [blame] | 31 | |
Ed Tanous | 52cc112 | 2020-07-18 13:51:21 -0700 | [diff] [blame] | 32 | ~ConfigFile() |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 33 | { |
Gunnar Mills | 83cf818 | 2020-11-11 15:37:34 -0600 | [diff] [blame] | 34 | // Make sure we aren't writing stale sessions |
| 35 | persistent_data::SessionStore::getInstance().applySessionTimeouts(); |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 36 | if (persistent_data::SessionStore::getInstance().needsWrite()) |
| 37 | { |
| 38 | writeData(); |
Kowalski, Kamil | 5cef0f7 | 2018-02-15 15:26:51 +0100 | [diff] [blame] | 39 | } |
Ed Tanous | c963aa4 | 2017-10-27 16:00:19 -0700 | [diff] [blame] | 40 | } |
Ed Tanous | c963aa4 | 2017-10-27 16:00:19 -0700 | [diff] [blame] | 41 | |
Ed Tanous | ecd6a3a | 2022-01-07 09:18:40 -0800 | [diff] [blame] | 42 | ConfigFile(const ConfigFile&) = delete; |
| 43 | ConfigFile(ConfigFile&&) = delete; |
| 44 | ConfigFile& operator=(const ConfigFile&) = delete; |
| 45 | ConfigFile& operator=(ConfigFile&&) = delete; |
| 46 | |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 47 | // TODO(ed) this should really use protobuf, or some other serialization |
| 48 | // library, but adding another dependency is somewhat outside the scope of |
| 49 | // this application for the moment |
| 50 | void readData() |
| 51 | { |
| 52 | std::ifstream persistentFile(filename); |
Ed Tanous | 271584a | 2019-07-09 16:24:22 -0700 | [diff] [blame] | 53 | uint64_t fileRevision = 0; |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 54 | if (persistentFile.is_open()) |
| 55 | { |
| 56 | // call with exceptions disabled |
| 57 | auto data = nlohmann::json::parse(persistentFile, nullptr, false); |
| 58 | if (data.is_discarded()) |
| 59 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 60 | BMCWEB_LOG_ERROR("Error parsing persistent data in json file."); |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 61 | } |
| 62 | else |
| 63 | { |
Ed Tanous | 0bdda66 | 2023-08-03 17:27:34 -0700 | [diff] [blame] | 64 | const nlohmann::json::object_t* obj = |
| 65 | data.get_ptr<nlohmann::json::object_t*>(); |
| 66 | if (obj == nullptr) |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 67 | { |
Ed Tanous | 0bdda66 | 2023-08-03 17:27:34 -0700 | [diff] [blame] | 68 | return; |
| 69 | } |
| 70 | for (const auto& item : *obj) |
| 71 | { |
| 72 | if (item.first == "revision") |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 73 | { |
| 74 | fileRevision = 0; |
| 75 | |
| 76 | const uint64_t* uintPtr = |
Ed Tanous | 0bdda66 | 2023-08-03 17:27:34 -0700 | [diff] [blame] | 77 | item.second.get_ptr<const uint64_t*>(); |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 78 | if (uintPtr == nullptr) |
| 79 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 80 | BMCWEB_LOG_ERROR("Failed to read revision flag"); |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 81 | } |
| 82 | else |
| 83 | { |
| 84 | fileRevision = *uintPtr; |
| 85 | } |
| 86 | } |
Ed Tanous | 0bdda66 | 2023-08-03 17:27:34 -0700 | [diff] [blame] | 87 | else if (item.first == "system_uuid") |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 88 | { |
| 89 | const std::string* jSystemUuid = |
Ed Tanous | 0bdda66 | 2023-08-03 17:27:34 -0700 | [diff] [blame] | 90 | item.second.get_ptr<const std::string*>(); |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 91 | if (jSystemUuid != nullptr) |
| 92 | { |
| 93 | systemUuid = *jSystemUuid; |
| 94 | } |
| 95 | } |
Ed Tanous | 0bdda66 | 2023-08-03 17:27:34 -0700 | [diff] [blame] | 96 | else if (item.first == "auth_config") |
Zbigniew Kurzynski | 7815863 | 2019-11-05 12:57:37 +0100 | [diff] [blame] | 97 | { |
| 98 | SessionStore::getInstance() |
| 99 | .getAuthMethodsConfig() |
Ed Tanous | 0bdda66 | 2023-08-03 17:27:34 -0700 | [diff] [blame] | 100 | .fromJson(item.second); |
Zbigniew Kurzynski | 7815863 | 2019-11-05 12:57:37 +0100 | [diff] [blame] | 101 | } |
Ed Tanous | 0bdda66 | 2023-08-03 17:27:34 -0700 | [diff] [blame] | 102 | else if (item.first == "sessions") |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 103 | { |
Ed Tanous | 0bdda66 | 2023-08-03 17:27:34 -0700 | [diff] [blame] | 104 | for (const auto& elem : item.second) |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 105 | { |
| 106 | std::shared_ptr<UserSession> newSession = |
| 107 | UserSession::fromJson(elem); |
| 108 | |
| 109 | if (newSession == nullptr) |
| 110 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 111 | BMCWEB_LOG_ERROR("Problem reading session " |
| 112 | "from persistent store"); |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 113 | continue; |
| 114 | } |
| 115 | |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 116 | BMCWEB_LOG_DEBUG("Restored session: {} {} {}", |
| 117 | newSession->csrfToken, |
| 118 | newSession->uniqueId, |
| 119 | newSession->sessionToken); |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 120 | SessionStore::getInstance().authTokens.emplace( |
| 121 | newSession->sessionToken, newSession); |
| 122 | } |
| 123 | } |
Ed Tanous | 0bdda66 | 2023-08-03 17:27:34 -0700 | [diff] [blame] | 124 | else if (item.first == "timeout") |
Manojkiran Eda | f2a4a60 | 2020-08-27 16:04:26 +0530 | [diff] [blame] | 125 | { |
| 126 | const int64_t* jTimeout = |
Ed Tanous | 0bdda66 | 2023-08-03 17:27:34 -0700 | [diff] [blame] | 127 | item.second.get_ptr<const int64_t*>(); |
Manojkiran Eda | f2a4a60 | 2020-08-27 16:04:26 +0530 | [diff] [blame] | 128 | if (jTimeout == nullptr) |
| 129 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 130 | BMCWEB_LOG_DEBUG( |
| 131 | "Problem reading session timeout value"); |
Manojkiran Eda | f2a4a60 | 2020-08-27 16:04:26 +0530 | [diff] [blame] | 132 | continue; |
| 133 | } |
| 134 | std::chrono::seconds sessionTimeoutInseconds(*jTimeout); |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 135 | BMCWEB_LOG_DEBUG("Restored Session Timeout: {}", |
| 136 | sessionTimeoutInseconds.count()); |
Manojkiran Eda | f2a4a60 | 2020-08-27 16:04:26 +0530 | [diff] [blame] | 137 | SessionStore::getInstance().updateSessionTimeout( |
| 138 | sessionTimeoutInseconds); |
| 139 | } |
Ed Tanous | 0bdda66 | 2023-08-03 17:27:34 -0700 | [diff] [blame] | 140 | else if (item.first == "eventservice_config") |
JunLin Chen | 28afb49 | 2021-02-24 17:13:29 +0800 | [diff] [blame] | 141 | { |
Ed Tanous | 0bdda66 | 2023-08-03 17:27:34 -0700 | [diff] [blame] | 142 | const nlohmann::json::object_t* esobj = |
| 143 | item.second |
| 144 | .get_ptr<const nlohmann::json::object_t*>(); |
| 145 | if (esobj == nullptr) |
| 146 | { |
| 147 | BMCWEB_LOG_DEBUG( |
| 148 | "Problem reading EventService value"); |
| 149 | continue; |
| 150 | } |
| 151 | |
JunLin Chen | 28afb49 | 2021-02-24 17:13:29 +0800 | [diff] [blame] | 152 | EventServiceStore::getInstance() |
| 153 | .getEventServiceConfig() |
Ed Tanous | 0bdda66 | 2023-08-03 17:27:34 -0700 | [diff] [blame] | 154 | .fromJson(*esobj); |
JunLin Chen | 28afb49 | 2021-02-24 17:13:29 +0800 | [diff] [blame] | 155 | } |
Ed Tanous | 0bdda66 | 2023-08-03 17:27:34 -0700 | [diff] [blame] | 156 | else if (item.first == "subscriptions") |
JunLin Chen | 28afb49 | 2021-02-24 17:13:29 +0800 | [diff] [blame] | 157 | { |
Ed Tanous | 0bdda66 | 2023-08-03 17:27:34 -0700 | [diff] [blame] | 158 | for (const auto& elem : item.second) |
JunLin Chen | 28afb49 | 2021-02-24 17:13:29 +0800 | [diff] [blame] | 159 | { |
| 160 | std::shared_ptr<UserSubscription> newSubscription = |
| 161 | UserSubscription::fromJson(elem); |
| 162 | |
| 163 | if (newSubscription == nullptr) |
| 164 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 165 | BMCWEB_LOG_ERROR("Problem reading subscription " |
| 166 | "from persistent store"); |
JunLin Chen | 28afb49 | 2021-02-24 17:13:29 +0800 | [diff] [blame] | 167 | continue; |
| 168 | } |
| 169 | |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 170 | BMCWEB_LOG_DEBUG("Restored subscription: {} {}", |
| 171 | newSubscription->id, |
| 172 | newSubscription->customText); |
JunLin Chen | 28afb49 | 2021-02-24 17:13:29 +0800 | [diff] [blame] | 173 | EventServiceStore::getInstance() |
| 174 | .subscriptionsConfigMap.emplace( |
| 175 | newSubscription->id, newSubscription); |
| 176 | } |
| 177 | } |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 178 | else |
| 179 | { |
| 180 | // Do nothing in the case of extra fields. We may have |
| 181 | // cases where fields are added in the future, and we |
| 182 | // want to at least attempt to gracefully support |
| 183 | // downgrades in that case, even if we don't officially |
| 184 | // support it |
| 185 | } |
| 186 | } |
| 187 | } |
| 188 | } |
| 189 | bool needWrite = false; |
| 190 | |
| 191 | if (systemUuid.empty()) |
| 192 | { |
Ed Tanous | 2c6ffdb | 2023-06-28 11:28:38 -0700 | [diff] [blame] | 193 | systemUuid = bmcweb::getRandomUUID(); |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 194 | needWrite = true; |
| 195 | } |
| 196 | if (fileRevision < jsonRevision) |
| 197 | { |
| 198 | needWrite = true; |
| 199 | } |
| 200 | // write revision changes or system uuid changes immediately |
| 201 | if (needWrite) |
| 202 | { |
| 203 | writeData(); |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | void writeData() |
| 208 | { |
| 209 | std::ofstream persistentFile(filename); |
Ratan Gupta | 845cb7d | 2019-07-12 00:32:25 +0530 | [diff] [blame] | 210 | |
| 211 | // set the permission of the file to 640 |
Ed Tanous | 52cc112 | 2020-07-18 13:51:21 -0700 | [diff] [blame] | 212 | std::filesystem::perms permission = |
| 213 | std::filesystem::perms::owner_read | |
| 214 | std::filesystem::perms::owner_write | |
| 215 | std::filesystem::perms::group_read; |
| 216 | std::filesystem::permissions(filename, permission); |
Ed Tanous | 3ce3688 | 2024-06-09 10:58:16 -0700 | [diff] [blame] | 217 | const AuthConfigMethods& c = |
| 218 | SessionStore::getInstance().getAuthMethodsConfig(); |
JunLin Chen | 28afb49 | 2021-02-24 17:13:29 +0800 | [diff] [blame] | 219 | const auto& eventServiceConfig = |
| 220 | EventServiceStore::getInstance().getEventServiceConfig(); |
Ed Tanous | 1476687 | 2022-03-15 10:44:42 -0700 | [diff] [blame] | 221 | nlohmann::json::object_t data; |
| 222 | nlohmann::json& authConfig = data["auth_config"]; |
Ratan Gupta | 845cb7d | 2019-07-12 00:32:25 +0530 | [diff] [blame] | 223 | |
Ed Tanous | 1476687 | 2022-03-15 10:44:42 -0700 | [diff] [blame] | 224 | authConfig["XToken"] = c.xtoken; |
| 225 | authConfig["Cookie"] = c.cookie; |
| 226 | authConfig["SessionToken"] = c.sessionToken; |
| 227 | authConfig["BasicAuth"] = c.basic; |
| 228 | authConfig["TLS"] = c.tls; |
Ed Tanous | 3281bcf | 2024-06-25 16:02:05 -0700 | [diff] [blame] | 229 | authConfig["TLSStrict"] = c.tlsStrict; |
Ed Tanous | 3ce3688 | 2024-06-09 10:58:16 -0700 | [diff] [blame] | 230 | authConfig["TLSCommonNameParseMode"] = |
| 231 | static_cast<int>(c.mTLSCommonNameParsingMode); |
JunLin Chen | 28afb49 | 2021-02-24 17:13:29 +0800 | [diff] [blame] | 232 | |
Ed Tanous | 1476687 | 2022-03-15 10:44:42 -0700 | [diff] [blame] | 233 | nlohmann::json& eventserviceConfig = data["eventservice_config"]; |
| 234 | eventserviceConfig["ServiceEnabled"] = eventServiceConfig.enabled; |
| 235 | eventserviceConfig["DeliveryRetryAttempts"] = |
| 236 | eventServiceConfig.retryAttempts; |
| 237 | eventserviceConfig["DeliveryRetryIntervalSeconds"] = |
| 238 | eventServiceConfig.retryTimeoutInterval; |
| 239 | |
| 240 | data["system_uuid"] = systemUuid; |
| 241 | data["revision"] = jsonRevision; |
| 242 | data["timeout"] = SessionStore::getInstance().getTimeoutInSeconds(); |
Ed Tanous | 5fb91ba | 2020-09-28 15:41:28 -0700 | [diff] [blame] | 243 | |
| 244 | nlohmann::json& sessions = data["sessions"]; |
| 245 | sessions = nlohmann::json::array(); |
| 246 | for (const auto& p : SessionStore::getInstance().authTokens) |
| 247 | { |
Ed Tanous | 89cda63 | 2024-04-16 08:45:54 -0700 | [diff] [blame] | 248 | if (p.second->sessionType != persistent_data::SessionType::Basic && |
| 249 | p.second->sessionType != |
| 250 | persistent_data::SessionType::MutualTLS) |
Ed Tanous | 5fb91ba | 2020-09-28 15:41:28 -0700 | [diff] [blame] | 251 | { |
Ed Tanous | 1476687 | 2022-03-15 10:44:42 -0700 | [diff] [blame] | 252 | nlohmann::json::object_t session; |
| 253 | session["unique_id"] = p.second->uniqueId; |
| 254 | session["session_token"] = p.second->sessionToken; |
| 255 | session["username"] = p.second->username; |
| 256 | session["csrf_token"] = p.second->csrfToken; |
| 257 | session["client_ip"] = p.second->clientIp; |
Ed Tanous | e01d0c3 | 2023-06-30 13:21:32 -0700 | [diff] [blame] | 258 | const std::optional<std::string>& clientId = p.second->clientId; |
| 259 | if (clientId) |
Ed Tanous | bb759e3 | 2022-08-02 17:07:54 -0700 | [diff] [blame] | 260 | { |
Ed Tanous | e01d0c3 | 2023-06-30 13:21:32 -0700 | [diff] [blame] | 261 | session["client_id"] = *clientId; |
Ed Tanous | bb759e3 | 2022-08-02 17:07:54 -0700 | [diff] [blame] | 262 | } |
Patrick Williams | b2ba307 | 2023-05-12 10:27:39 -0500 | [diff] [blame] | 263 | sessions.emplace_back(std::move(session)); |
Ed Tanous | 5fb91ba | 2020-09-28 15:41:28 -0700 | [diff] [blame] | 264 | } |
| 265 | } |
JunLin Chen | 28afb49 | 2021-02-24 17:13:29 +0800 | [diff] [blame] | 266 | nlohmann::json& subscriptions = data["subscriptions"]; |
| 267 | subscriptions = nlohmann::json::array(); |
| 268 | for (const auto& it : |
| 269 | EventServiceStore::getInstance().subscriptionsConfigMap) |
| 270 | { |
wenlitao | fbfb788 | 2024-07-12 11:25:00 +0800 | [diff] [blame] | 271 | const UserSubscription& subValue = *it.second; |
| 272 | if (subValue.subscriptionType == "SSE") |
JunLin Chen | 28afb49 | 2021-02-24 17:13:29 +0800 | [diff] [blame] | 273 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 274 | BMCWEB_LOG_DEBUG("The subscription type is SSE, so skipping."); |
JunLin Chen | 28afb49 | 2021-02-24 17:13:29 +0800 | [diff] [blame] | 275 | continue; |
| 276 | } |
Ed Tanous | 601c71a | 2021-09-08 16:40:12 -0700 | [diff] [blame] | 277 | nlohmann::json::object_t headers; |
| 278 | for (const boost::beast::http::fields::value_type& header : |
wenlitao | fbfb788 | 2024-07-12 11:25:00 +0800 | [diff] [blame] | 279 | subValue.httpHeaders) |
Ed Tanous | 601c71a | 2021-09-08 16:40:12 -0700 | [diff] [blame] | 280 | { |
| 281 | // Note, these are technically copies because nlohmann doesn't |
| 282 | // support key lookup by std::string_view. At least the |
| 283 | // following code can use move |
| 284 | // https://github.com/nlohmann/json/issues/1529 |
| 285 | std::string name(header.name_string()); |
| 286 | headers[std::move(name)] = header.value(); |
| 287 | } |
| 288 | |
Ed Tanous | 1476687 | 2022-03-15 10:44:42 -0700 | [diff] [blame] | 289 | nlohmann::json::object_t subscription; |
| 290 | |
wenlitao | fbfb788 | 2024-07-12 11:25:00 +0800 | [diff] [blame] | 291 | subscription["Id"] = subValue.id; |
| 292 | subscription["Context"] = subValue.customText; |
| 293 | subscription["DeliveryRetryPolicy"] = subValue.retryPolicy; |
| 294 | subscription["Destination"] = subValue.destinationUrl; |
| 295 | subscription["EventFormatType"] = subValue.eventFormatType; |
Ed Tanous | 1476687 | 2022-03-15 10:44:42 -0700 | [diff] [blame] | 296 | subscription["HttpHeaders"] = std::move(headers); |
wenlitao | fbfb788 | 2024-07-12 11:25:00 +0800 | [diff] [blame] | 297 | subscription["MessageIds"] = subValue.registryMsgIds; |
| 298 | subscription["Protocol"] = subValue.protocol; |
| 299 | subscription["RegistryPrefixes"] = subValue.registryPrefixes; |
Ed Tanous | a14c911 | 2024-09-04 10:46:47 -0700 | [diff] [blame] | 300 | subscription["OriginResources"] = subValue.originResources; |
wenlitao | fbfb788 | 2024-07-12 11:25:00 +0800 | [diff] [blame] | 301 | subscription["ResourceTypes"] = subValue.resourceTypes; |
| 302 | subscription["SubscriptionType"] = subValue.subscriptionType; |
Ed Tanous | 1476687 | 2022-03-15 10:44:42 -0700 | [diff] [blame] | 303 | subscription["MetricReportDefinitions"] = |
wenlitao | fbfb788 | 2024-07-12 11:25:00 +0800 | [diff] [blame] | 304 | subValue.metricReportDefinitions; |
Ed Tanous | 19bb362 | 2024-07-05 10:07:40 -0500 | [diff] [blame] | 305 | subscription["VerifyCertificate"] = subValue.verifyCertificate; |
Ed Tanous | 1476687 | 2022-03-15 10:44:42 -0700 | [diff] [blame] | 306 | |
Patrick Williams | b2ba307 | 2023-05-12 10:27:39 -0500 | [diff] [blame] | 307 | subscriptions.emplace_back(std::move(subscription)); |
JunLin Chen | 28afb49 | 2021-02-24 17:13:29 +0800 | [diff] [blame] | 308 | } |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 309 | persistentFile << data; |
| 310 | } |
| 311 | |
Ed Tanous | e05aec5 | 2022-01-25 10:28:56 -0800 | [diff] [blame] | 312 | std::string systemUuid; |
Ed Tanous | ba9f9a6 | 2017-10-11 16:40:35 -0700 | [diff] [blame] | 313 | }; |
| 314 | |
Ed Tanous | 52cc112 | 2020-07-18 13:51:21 -0700 | [diff] [blame] | 315 | inline ConfigFile& getConfig() |
| 316 | { |
| 317 | static ConfigFile f; |
| 318 | return f; |
| 319 | } |
| 320 | |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 321 | } // namespace persistent_data |