blob: ddab5dc1eb6a50ccc24e1901e3f86dc1b453b675 [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 "aos/seasocks/seasocks_logger.h"
6#include "gflags/gflags.h"
Alex Perryb3b50792020-01-18 16:13:45 -08007
8#include "internal/Embedded.h"
9#include "seasocks/Server.h"
10#include "seasocks/WebSocket.h"
11
Alex Perry5f474f22020-02-01 12:14:24 -080012DEFINE_string(config, "./config.json", "File path of aos configuration");
13DEFINE_string(data_dir, "www", "Directory to serve data files from");
James Kuszmaul71a81932020-12-15 21:08:01 -080014DEFINE_int32(buffer_size, 0, "-1 if infinite, in # of messages / channel.");
Alex Perry5f474f22020-02-01 12:14:24 -080015
Alex Perry5f474f22020-02-01 12:14:24 -080016int main(int argc, char **argv) {
Alex Perry5f474f22020-02-01 12:14:24 -080017 aos::InitGoogle(&argc, &argv);
James Kuszmaul7ad91522020-09-01 19:15:35 -070018 // Make sure to reference this to force the linker to include it.
Alex Perryb3b50792020-01-18 16:13:45 -080019 findEmbeddedContent("");
20
Alex Perry5f474f22020-02-01 12:14:24 -080021 aos::FlatbufferDetachedBuffer<aos::Configuration> config =
22 aos::configuration::ReadConfig(FLAGS_config);
Alex Perryb3b50792020-01-18 16:13:45 -080023
James Kuszmaul7ad91522020-09-01 19:15:35 -070024 aos::ShmEventLoop event_loop(&config.message());
Alex Perry5f474f22020-02-01 12:14:24 -080025
James Kuszmaul71a81932020-12-15 21:08:01 -080026 aos::web_proxy::WebProxy web_proxy(&event_loop, FLAGS_buffer_size);
27 web_proxy.SetDataPath(FLAGS_data_dir.c_str());
Alex Perry5f474f22020-02-01 12:14:24 -080028
James Kuszmaul71a81932020-12-15 21:08:01 -080029 event_loop.Run();
Alex Perryb3b50792020-01-18 16:13:45 -080030}