- Add Hook interface (filter + execute contract) in server/hooks/hook.h
- Add HookRunner in server/hooks/hook_runner.h: spawns a detached thread
per matching hook, with try/catch protection against crashes
- Add DnsUpdaterHook in server/hooks/dns_updater_hook.{h,cpp}:
triggers on server name changes, logs in to Technitium, deletes the
old A record (ignores 404), and adds the new A record
Config via env vars: TECHNITIUM_HOST/PORT/USER/PASS/ZONE, DNS_TTL
- Add Database::get_nics_for_server() to resolve a server's IPv4 address
- Wire HookRunner into InventoryServer; cmd_edit_server now fires hooks
with before/after Server snapshots
- Update CMakeLists.txt to include dns_updater_hook.cpp
- Document env vars in Dockerfile
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
33 lines
861 B
CMake
33 lines
861 B
CMake
cmake_minimum_required(VERSION 3.16)
|
|
project(device-inventory VERSION 1.0.0 LANGUAGES CXX)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
# Compiler warnings
|
|
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU")
|
|
add_compile_options(-Wall -Wextra -Wpedantic)
|
|
endif()
|
|
|
|
# Server executable
|
|
add_executable(inventory-server
|
|
src/server/main.cpp
|
|
src/server/database.cpp
|
|
src/server/server.cpp
|
|
src/server/hooks/dns_updater_hook.cpp
|
|
)
|
|
target_include_directories(inventory-server PRIVATE src)
|
|
target_link_libraries(inventory-server PRIVATE pthread)
|
|
|
|
# Client executable
|
|
add_executable(inventory-cli
|
|
src/client/main.cpp
|
|
src/client/client.cpp
|
|
src/client/discovery.cpp
|
|
)
|
|
target_include_directories(inventory-cli PRIVATE src)
|
|
|
|
install(TARGETS inventory-server inventory-cli
|
|
RUNTIME DESTINATION bin
|
|
)
|