Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 1 | #include "aos/events/shm_event_loop.h" |
Alex Perry | 09648e0 | 2020-02-28 19:50:29 -0800 | [diff] [blame] | 2 | #include "aos/flatbuffer_merge.h" |
Alex Perry | b3b5079 | 2020-01-18 16:13:45 -0800 | [diff] [blame] | 3 | #include "aos/init.h" |
Alex Perry | b3b5079 | 2020-01-18 16:13:45 -0800 | [diff] [blame] | 4 | #include "aos/network/web_proxy.h" |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 5 | #include "gflags/gflags.h" |
Alex Perry | b3b5079 | 2020-01-18 16:13:45 -0800 | [diff] [blame] | 6 | |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 7 | DEFINE_string(config, "./config.json", "File path of aos configuration"); |
| 8 | DEFINE_string(data_dir, "www", "Directory to serve data files from"); |
James Kuszmaul | 1a29c08 | 2022-02-03 14:02:47 -0800 | [diff] [blame^] | 9 | DEFINE_int32(buffer_size, 1000000, |
| 10 | "-1 if infinite, in bytes / channel. If there are no active " |
| 11 | "connections, will not store anything."); |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 12 | |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 13 | int main(int argc, char **argv) { |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 14 | aos::InitGoogle(&argc, &argv); |
Alex Perry | b3b5079 | 2020-01-18 16:13:45 -0800 | [diff] [blame] | 15 | |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 16 | aos::FlatbufferDetachedBuffer<aos::Configuration> config = |
| 17 | aos::configuration::ReadConfig(FLAGS_config); |
Alex Perry | b3b5079 | 2020-01-18 16:13:45 -0800 | [diff] [blame] | 18 | |
James Kuszmaul | 7ad9152 | 2020-09-01 19:15:35 -0700 | [diff] [blame] | 19 | aos::ShmEventLoop event_loop(&config.message()); |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 20 | |
James Kuszmaul | 1a29c08 | 2022-02-03 14:02:47 -0800 | [diff] [blame^] | 21 | aos::web_proxy::WebProxy web_proxy( |
| 22 | &event_loop, aos::web_proxy::StoreHistory::kNo, FLAGS_buffer_size); |
James Kuszmaul | 71a8193 | 2020-12-15 21:08:01 -0800 | [diff] [blame] | 23 | web_proxy.SetDataPath(FLAGS_data_dir.c_str()); |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 24 | |
James Kuszmaul | 71a8193 | 2020-12-15 21:08:01 -0800 | [diff] [blame] | 25 | event_loop.Run(); |
Alex Perry | b3b5079 | 2020-01-18 16:13:45 -0800 | [diff] [blame] | 26 | } |