blob: 7684b06429396680ab803cc4865ce889ffb2a0e2 [file] [log] [blame]
Philipp Schrader790cb542023-07-05 21:06:52 -07001#include "gflags/gflags.h"
2
Alex Perry5f474f22020-02-01 12:14:24 -08003#include "aos/events/shm_event_loop.h"
Alex Perry09648e02020-02-28 19:50:29 -08004#include "aos/flatbuffer_merge.h"
Alex Perryb3b50792020-01-18 16:13:45 -08005#include "aos/init.h"
Alex Perryb3b50792020-01-18 16:13:45 -08006#include "aos/network/web_proxy.h"
7
Austin Schuh8e2dfc62022-08-17 16:36:00 -07008DEFINE_string(config, "aos_config.json", "File path of aos configuration");
Alex Perry5f474f22020-02-01 12:14:24 -08009DEFINE_string(data_dir, "www", "Directory to serve data files from");
James Kuszmaul1a29c082022-02-03 14:02:47 -080010DEFINE_int32(buffer_size, 1000000,
11 "-1 if infinite, in bytes / channel. If there are no active "
12 "connections, will not store anything.");
Alex Perry5f474f22020-02-01 12:14:24 -080013
Alex Perry5f474f22020-02-01 12:14:24 -080014int main(int argc, char **argv) {
Alex Perry5f474f22020-02-01 12:14:24 -080015 aos::InitGoogle(&argc, &argv);
Alex Perryb3b50792020-01-18 16:13:45 -080016
Alex Perry5f474f22020-02-01 12:14:24 -080017 aos::FlatbufferDetachedBuffer<aos::Configuration> config =
18 aos::configuration::ReadConfig(FLAGS_config);
Alex Perryb3b50792020-01-18 16:13:45 -080019
James Kuszmaul7ad91522020-09-01 19:15:35 -070020 aos::ShmEventLoop event_loop(&config.message());
Alex Perry5f474f22020-02-01 12:14:24 -080021
James Kuszmaul1a29c082022-02-03 14:02:47 -080022 aos::web_proxy::WebProxy web_proxy(
23 &event_loop, aos::web_proxy::StoreHistory::kNo, FLAGS_buffer_size);
James Kuszmaul71a81932020-12-15 21:08:01 -080024 web_proxy.SetDataPath(FLAGS_data_dir.c_str());
Alex Perry5f474f22020-02-01 12:14:24 -080025
James Kuszmaul71a81932020-12-15 21:08:01 -080026 event_loop.Run();
Alex Perryb3b50792020-01-18 16:13:45 -080027}