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