From e275818050b6ed6025301e5c9c695031ff997e83 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 3 May 2025 16:19:49 +1200 Subject: [PATCH] Allow alternate config location for Docker (/data/sos_config.json) --- build.sh | 2 +- src/main.cpp | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index 1437a76..899d737 100755 --- a/build.sh +++ b/build.sh @@ -51,7 +51,7 @@ echo "Setting up Docker BuildX" docker buildx create --name mybuilder --use || true echo "Building multi-platform Docker image" -docker buildx build --load -t simple-object-storage:latest --platform linux/amd64,linux/arm64 . +docker buildx build --push -t gitea.jde.nz/j/simple-object-storage:latest --platform linux/amd64,linux/arm64 . echo "Build completed successfully!" diff --git a/src/main.cpp b/src/main.cpp index 071bb44..b4ebef9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -7,8 +7,13 @@ namespace simple_object_storage { int main(int argc, char* argv[]) { - std::filesystem::path config_path = std::filesystem::path(std::getenv("HOME")) / ".config/simple_object_storage/config.json"; - std::filesystem::create_directories(config_path.parent_path()); + + std::filesystem::path config_path = "/data/sos_config.json"; + if (!std::filesystem::exists(config_path)) + config_path = std::filesystem::path(std::getenv("HOME")) / ".config/simple_object_storage/config.json"; + + if (!std::filesystem::exists(config_path)) + std::filesystem::create_directories(config_path.parent_path()); ServerConfig config; if (!simple_object_storage::load_config(config_path, config)) {