Bug fixing

This commit is contained in:
Your Name
2025-05-25 15:11:13 +12:00
parent 27acc9f9f0
commit 3033701d6c
3 changed files with 11 additions and 12 deletions

View File

@@ -17,10 +17,7 @@ bool load_config(const std::string& config_path, ServerConfig& config) {
nlohmann::json j;
file >> j;
config.host = "0.0.0.0";
config.port = 8123;
config.object_store_path = "/data/storage";
config.write_tokens = {};
config = ServerConfig(); // set defaults.
// Parse write tokens
if (j.contains("write_tokens")) {

View File

@@ -9,17 +9,19 @@ namespace simple_object_storage {
struct ServerConfig {
std::vector<std::string> write_tokens;
std::filesystem::path object_store_path;
std::filesystem::path object_store_path = "/data/storage";
std::string host = "0.0.0.0";
uint16_t port = 0;
uint16_t port = 80;
// CORS configuration
std::vector<std::string> allowed_origins = {"*"}; // Default to allow all origins
std::vector<std::string> allowed_methods = {"GET", "PUT", "POST", "DELETE", "OPTIONS"};
std::vector<std::string> allowed_headers = {"Authorization", "Content-Type"};
bool allow_credentials = false;
// Rate limiting configuration
int auth_rate_limit = 5; // Maximum number of auth attempts
int auth_window_seconds = 10; // Time window in seconds (10 seconds)
int auth_window_seconds = 300; // Time window in seconds (5 minutes)
};
bool load_config(const std::string& config_path, ServerConfig& config);