.
This commit is contained in:
15
src/main.cpp
15
src/main.cpp
@@ -4,16 +4,17 @@
|
||||
#include <string>
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
if (argc != 2) {
|
||||
std::cerr << "Usage: " << argv[0] << " <config_file>" << std::endl;
|
||||
std::filesystem::path config_path = std::filesystem::path(std::getenv("HOME")) / ".config/dropshell_template_registry/config.json";
|
||||
std::filesystem::create_directories(config_path.parent_path());
|
||||
|
||||
dropshell::ServerConfig config;
|
||||
if (!dropshell::load_config(config_path, config)) {
|
||||
std::cerr << "Failed to load configuration at "<<config_path << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
dropshell::ServerConfig config;
|
||||
if (!dropshell::load_config(argv[1], config)) {
|
||||
std::cerr << "Failed to load configuration" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
std::cout << "Starting server at " << config.host << ":" << config.port << std::endl;
|
||||
std::cout << "Object store path: " << config.object_store_path << std::endl;
|
||||
|
||||
dropshell::Server server(config);
|
||||
if (!server.start()) {
|
||||
|
@@ -107,7 +107,7 @@ void Server::handle_connection(int client_socket) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (path == "/index.html") {
|
||||
if (path == "/index.html" || path == "/") {
|
||||
send_response(client_socket, 200, "text/html",
|
||||
"<html><body><h1>Dropshell Template Registry</h1></body></html>");
|
||||
return;
|
||||
|
Reference in New Issue
Block a user