blob: 06fe9428c1f7d369f31635333e0b0f32c61ca116 [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
Alex Perry5f474f22020-02-01 12:14:24 -08007DEFINE_string(config, "./config.json", "File path of aos configuration");
8DEFINE_string(data_dir, "www", "Directory to serve data files from");
James Kuszmaul71a81932020-12-15 21:08:01 -08009DEFINE_int32(buffer_size, 0, "-1 if infinite, in # of messages / channel.");
Alex Perry5f474f22020-02-01 12:14:24 -080010
Alex Perry5f474f22020-02-01 12:14:24 -080011int main(int argc, char **argv) {
Alex Perry5f474f22020-02-01 12:14:24 -080012 aos::InitGoogle(&argc, &argv);
Alex Perryb3b50792020-01-18 16:13:45 -080013
Alex Perry5f474f22020-02-01 12:14:24 -080014 aos::FlatbufferDetachedBuffer<aos::Configuration> config =
15 aos::configuration::ReadConfig(FLAGS_config);
Alex Perryb3b50792020-01-18 16:13:45 -080016
James Kuszmaul7ad91522020-09-01 19:15:35 -070017 aos::ShmEventLoop event_loop(&config.message());
Alex Perry5f474f22020-02-01 12:14:24 -080018
James Kuszmaul71a81932020-12-15 21:08:01 -080019 aos::web_proxy::WebProxy web_proxy(&event_loop, FLAGS_buffer_size);
20 web_proxy.SetDataPath(FLAGS_data_dir.c_str());
Alex Perry5f474f22020-02-01 12:14:24 -080021
James Kuszmaul71a81932020-12-15 21:08:01 -080022 event_loop.Run();
Alex Perryb3b50792020-01-18 16:13:45 -080023}