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