From ae122619388ffea6276d2c573b9ba6227acf630a Mon Sep 17 00:00:00 2001 From: Hepatica Date: Sun, 18 Aug 2024 21:05:28 +0200 Subject: [PATCH] Introduce envoronment variables and refresh secrets --- SpCloudMain/Service/DiscordService.cpp | 2 +- SpCloudMain/Service/MongoDbService.cpp | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/SpCloudMain/Service/DiscordService.cpp b/SpCloudMain/Service/DiscordService.cpp index 0257780..f2b5205 100644 --- a/SpCloudMain/Service/DiscordService.cpp +++ b/SpCloudMain/Service/DiscordService.cpp @@ -24,7 +24,7 @@ public: std::string command = "curl --location https://discord.com/api/oauth2/token " "--header \"Content-Type: application/x-www-form-urlencoded\" " "--data-urlencode \"client_id=1273414933874479185\" " - "--data-urlencode \"client_secret=S_vG4frjIxWoi8mic_GlcxUO0aWxXwRJ\" " + "--data-urlencode \"client_secret=" + std::string(std::getenv("DiscordAppSecret")) + "\" " "--data-urlencode \"grant_type=authorization_code\" " "--data-urlencode \"code=" + auth_code_processed + "\" " "--data-urlencode \"redirect_uri=https://spcloud.almavid.ru\""; diff --git a/SpCloudMain/Service/MongoDbService.cpp b/SpCloudMain/Service/MongoDbService.cpp index 2ba2c83..2a830d3 100644 --- a/SpCloudMain/Service/MongoDbService.cpp +++ b/SpCloudMain/Service/MongoDbService.cpp @@ -27,7 +27,7 @@ public: std::string command = "curl --location 'https://eu-central-1.aws.data.mongodb-api.com/app/data-zvcqvrr/endpoint/data/v1/action/findOne' " "--header 'Content-Type: application/json' " - "--header 'api-key: Q1NfSCrruUAzsxdrjhZd3sjSwiqbdSFmCLeaCatZiuohUXsvEq9RtEAeG0JL2Jd7' " + "--header 'api-key: " + std::string(std::getenv("MongoDbApiKey")) + "' " "--data-raw '" + json_data + "'"; auto request = std::async(std::launch::async, &MongoDbService::execute_command, this, command); @@ -55,7 +55,7 @@ public: "curl --location 'https://eu-central-1.aws.data.mongodb-api.com/app/data-zvcqvrr/endpoint/data/v1/action/updateOne' " "--header 'Content-Type: application/json' " "--header 'Access-Control-Request-Headers: *' " - "--header 'api-key: Q1NfSCrruUAzsxdrjhZd3sjSwiqbdSFmCLeaCatZiuohUXsvEq9RtEAeG0JL2Jd7' " + "--header 'api-key: " + std::string(std::getenv("MongoDbApiKey")) + "' " "--data '" + json_data + "'"; auto request = std::async(std::launch::async, &MongoDbService::execute_command, this, command); @@ -83,7 +83,7 @@ public: "curl --location 'https://eu-central-1.aws.data.mongodb-api.com/app/data-zvcqvrr/endpoint/data/v1/action/updateOne' " "--header 'Content-Type: application/json' " "--header 'Access-Control-Request-Headers: *' " - "--header 'api-key: Q1NfSCrruUAzsxdrjhZd3sjSwiqbdSFmCLeaCatZiuohUXsvEq9RtEAeG0JL2Jd7' " + "--header 'api-key: " + std::string(std::getenv("MongoDbApiKey")) + "' " "--data '" + json_data + "'"; auto request = std::async(std::launch::async, &MongoDbService::execute_command, this, command); @@ -107,7 +107,7 @@ public: std::string command = "curl --location 'https://eu-central-1.aws.data.mongodb-api.com/app/data-zvcqvrr/endpoint/data/v1/action/deleteOne' " "--header 'Content-Type: application/json' " - "--header 'api-key: Q1NfSCrruUAzsxdrjhZd3sjSwiqbdSFmCLeaCatZiuohUXsvEq9RtEAeG0JL2Jd7' " + "--header 'api-key: " + std::string(std::getenv("MongoDbApiKey")) + "' " "--data '" + json_data + "'"; auto request = std::async(std::launch::async, &MongoDbService::execute_command, this, command); @@ -131,7 +131,7 @@ public: std::string command = "curl --location 'https://eu-central-1.aws.data.mongodb-api.com/app/data-zvcqvrr/endpoint/data/v1/action/findOne' " "--header 'Content-Type: application/json' " - "--header 'api-key: Q1NfSCrruUAzsxdrjhZd3sjSwiqbdSFmCLeaCatZiuohUXsvEq9RtEAeG0JL2Jd7' " + "--header 'api-key: " + std::string(std::getenv("MongoDbApiKey")) + "' " "--data-raw '" + json_data + "'"; auto request = std::async(std::launch::async, &MongoDbService::execute_command, this, command); @@ -178,7 +178,7 @@ public: std::string command = "curl --location 'https://eu-central-1.aws.data.mongodb-api.com/app/data-zvcqvrr/endpoint/data/v1/action/findOne' " "--header 'Content-Type: application/json' " - "--header 'api-key: Q1NfSCrruUAzsxdrjhZd3sjSwiqbdSFmCLeaCatZiuohUXsvEq9RtEAeG0JL2Jd7' " + "--header 'api-key: " + std::string(std::getenv("MongoDbApiKey")) + "' " "--data-raw '" + json_data + "'"; auto request = std::async(std::launch::async, &MongoDbService::execute_command, this, command); @@ -207,7 +207,7 @@ public: std::string command = "curl --location 'https://eu-central-1.aws.data.mongodb-api.com/app/data-zvcqvrr/endpoint/data/v1/action/findOne' " "--header 'Content-Type: application/json' " - "--header 'api-key: Q1NfSCrruUAzsxdrjhZd3sjSwiqbdSFmCLeaCatZiuohUXsvEq9RtEAeG0JL2Jd7' " + "--header 'api-key: " + std::string(std::getenv("MongoDbApiKey")) + "' " "--data-raw '" + json_data + "'"; auto request = std::async(std::launch::async, &MongoDbService::execute_command, this, command); @@ -256,7 +256,7 @@ public: std::string command = "curl --location 'https://eu-central-1.aws.data.mongodb-api.com/app/data-zvcqvrr/endpoint/data/v1/action/findOne' " "--header 'Content-Type: application/json' " - "--header 'api-key: Q1NfSCrruUAzsxdrjhZd3sjSwiqbdSFmCLeaCatZiuohUXsvEq9RtEAeG0JL2Jd7' " + "--header 'api-key: " + std::string(std::getenv("MongoDbApiKey")) + "' " "--data-raw '" + json_data + "'"; auto request = std::async(std::launch::async, &MongoDbService::execute_command, this, command); @@ -288,7 +288,7 @@ public: std::string command = "curl --location 'https://eu-central-1.aws.data.mongodb-api.com/app/data-zvcqvrr/endpoint/data/v1/action/findOne' " "--header 'Content-Type: application/json' " - "--header 'api-key: Q1NfSCrruUAzsxdrjhZd3sjSwiqbdSFmCLeaCatZiuohUXsvEq9RtEAeG0JL2Jd7' " + "--header 'api-key: " + std::string(std::getenv("MongoDbApiKey")) + "' " "--data-raw '" + json_data + "'"; auto request = std::async(std::launch::async, &MongoDbService::execute_command, this, command); @@ -321,7 +321,7 @@ public: std::string command = "curl --location 'https://eu-central-1.aws.data.mongodb-api.com/app/data-zvcqvrr/endpoint/data/v1/action/insertOne' " "--header 'Content-Type: application/json' " - "--header 'api-key: Q1NfSCrruUAzsxdrjhZd3sjSwiqbdSFmCLeaCatZiuohUXsvEq9RtEAeG0JL2Jd7' " + "--header 'api-key: " + std::string(std::getenv("MongoDbApiKey")) + "' " "--data-raw '" + json_data + "'"; auto request = std::async(std::launch::async, &MongoDbService::execute_command, this, command); @@ -344,7 +344,7 @@ public: std::string command = "curl --location 'https://eu-central-1.aws.data.mongodb-api.com/app/data-zvcqvrr/endpoint/data/v1/action/find' " "--header 'Content-Type: application/json' " - "--header 'api-key: Q1NfSCrruUAzsxdrjhZd3sjSwiqbdSFmCLeaCatZiuohUXsvEq9RtEAeG0JL2Jd7' " + "--header 'api-key: " + std::string(std::getenv("MongoDbApiKey")) + "' " "--data-raw '" + json_data + "'"; auto request = std::async(std::launch::async, &MongoDbService::execute_command, this, command);