@@ -0,0 +1,59 @@
|
||||
#pragma once
|
||||
|
||||
#include <chrono>
|
||||
#include <expected>
|
||||
#include <string>
|
||||
|
||||
#include <boost/json/value.hpp>
|
||||
|
||||
#include <ligo.hpp>
|
||||
#include <luma.hpp>
|
||||
#include <modulus.hpp>
|
||||
|
||||
#include <types.hpp>
|
||||
#include <vamp_zero/types.hpp>
|
||||
|
||||
namespace vamp_zero {
|
||||
|
||||
struct runtime_config {
|
||||
vamp_zero::hardware_mode hardware{vamp_zero::hardware_mode::REAL};
|
||||
std::bool_t headless{false};
|
||||
std::bool_t exit_after_startup{false};
|
||||
std::string assets_path{"/usr/share/product-vamp"};
|
||||
std::string heartbeat_path{"/run/product-vamp/heartbeat.json"};
|
||||
};
|
||||
|
||||
struct database_config {
|
||||
std::string path{"/var/lib/product-vamp/vamp.db"};
|
||||
std::string migrations_path{"/usr/share/product-vamp/migrations"};
|
||||
};
|
||||
|
||||
struct control_config {
|
||||
ligo::endpoint_config endpoint{
|
||||
.name = "product-vamp-control",
|
||||
.protocol = ligo::protocol::HTTP,
|
||||
.bind = "0.0.0.0:8080",
|
||||
.timeout = std::chrono::milliseconds{5000},
|
||||
.http = {
|
||||
.max_body_size = 64U * 1024U,
|
||||
},
|
||||
};
|
||||
std::string ap_ssid{"Vamp Control"};
|
||||
std::string ap_passphrase{"vamp-control"};
|
||||
std::string ap_interface{"wlan0"};
|
||||
std::string zero_ip{"192.168.42.1"};
|
||||
std::string zero_cidr{"192.168.42.1/24"};
|
||||
};
|
||||
|
||||
struct config {
|
||||
modulus::config modulus{};
|
||||
vamp_zero::runtime_config runtime{};
|
||||
vamp_zero::database_config database{};
|
||||
vamp_zero::control_config control{};
|
||||
luma::application_config display{.title = "Product Vamp"};
|
||||
};
|
||||
|
||||
auto parse_config(boost::json::value const& value) -> std::expected<vamp_zero::config, modulus::error>;
|
||||
auto load_config(std::string const& path) -> std::expected<vamp_zero::config, modulus::error>;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user