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 "aos/seasocks/seasocks_logger.h" |
| 6 | #include "gflags/gflags.h" |
Alex Perry | b3b5079 | 2020-01-18 16:13:45 -0800 | [diff] [blame] | 7 | |
| 8 | #include "internal/Embedded.h" |
| 9 | #include "seasocks/Server.h" |
| 10 | #include "seasocks/WebSocket.h" |
| 11 | |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 12 | DEFINE_string(config, "./config.json", "File path of aos configuration"); |
| 13 | DEFINE_string(data_dir, "www", "Directory to serve data files from"); |
James Kuszmaul | 71a8193 | 2020-12-15 21:08:01 -0800 | [diff] [blame^] | 14 | DEFINE_int32(buffer_size, 0, "-1 if infinite, in # of messages / channel."); |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 15 | |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 16 | int main(int argc, char **argv) { |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 17 | aos::InitGoogle(&argc, &argv); |
James Kuszmaul | 7ad9152 | 2020-09-01 19:15:35 -0700 | [diff] [blame] | 18 | // Make sure to reference this to force the linker to include it. |
Alex Perry | b3b5079 | 2020-01-18 16:13:45 -0800 | [diff] [blame] | 19 | findEmbeddedContent(""); |
| 20 | |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 21 | aos::FlatbufferDetachedBuffer<aos::Configuration> config = |
| 22 | aos::configuration::ReadConfig(FLAGS_config); |
Alex Perry | b3b5079 | 2020-01-18 16:13:45 -0800 | [diff] [blame] | 23 | |
James Kuszmaul | 7ad9152 | 2020-09-01 19:15:35 -0700 | [diff] [blame] | 24 | aos::ShmEventLoop event_loop(&config.message()); |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 25 | |
James Kuszmaul | 71a8193 | 2020-12-15 21:08:01 -0800 | [diff] [blame^] | 26 | aos::web_proxy::WebProxy web_proxy(&event_loop, FLAGS_buffer_size); |
| 27 | web_proxy.SetDataPath(FLAGS_data_dir.c_str()); |
Alex Perry | 5f474f2 | 2020-02-01 12:14:24 -0800 | [diff] [blame] | 28 | |
James Kuszmaul | 71a8193 | 2020-12-15 21:08:01 -0800 | [diff] [blame^] | 29 | event_loop.Run(); |
Alex Perry | b3b5079 | 2020-01-18 16:13:45 -0800 | [diff] [blame] | 30 | } |