diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-12-13 18:52:22 -0500 |
|---|---|---|
| committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-12-13 18:52:22 -0500 |
| commit | 26425968306ee3c2119693f475eb155e9d93eddd (patch) | |
| tree | 18cdc4377e0482ee83a9c501e3d9995599113f23 | |
| parent | ea06cf4b110362b9e4cb86e07d65139521a1533e (diff) | |
| download | composite-26425968306ee3c2119693f475eb155e9d93eddd.tar.gz composite-26425968306ee3c2119693f475eb155e9d93eddd.tar.bz2 composite-26425968306ee3c2119693f475eb155e9d93eddd.zip | |
Bot now takes path to config file as argument
That config file now also has to contain the path to the verbly datafile.
| -rw-r--r-- | composite.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
| diff --git a/composite.cpp b/composite.cpp index 49a2301..2b33fb1 100644 --- a/composite.cpp +++ b/composite.cpp | |||
| @@ -8,7 +8,14 @@ | |||
| 8 | 8 | ||
| 9 | int main(int argc, char** argv) | 9 | int main(int argc, char** argv) |
| 10 | { | 10 | { |
| 11 | YAML::Node config = YAML::LoadFile("config.yml"); | 11 | if (argc != 2) |
| 12 | { | ||
| 13 | std::cout << "usage: composite [configfile]" << std::endl; | ||
| 14 | return -1; | ||
| 15 | } | ||
| 16 | |||
| 17 | std::string configfile(argv[1]); | ||
| 18 | YAML::Node config = YAML::LoadFile(configfile); | ||
| 12 | 19 | ||
| 13 | twitter::auth auth; | 20 | twitter::auth auth; |
| 14 | auth.setConsumerKey(config["consumer_key"].as<std::string>()); | 21 | auth.setConsumerKey(config["consumer_key"].as<std::string>()); |
| @@ -17,7 +24,7 @@ int main(int argc, char** argv) | |||
| 17 | auth.setAccessSecret(config["access_secret"].as<std::string>()); | 24 | auth.setAccessSecret(config["access_secret"].as<std::string>()); |
| 18 | 25 | ||
| 19 | twitter::client client(auth); | 26 | twitter::client client(auth); |
| 20 | verbly::data database("data.sqlite3"); | 27 | verbly::data database(config["verbly_datafile"].as<std::string>()); |
| 21 | 28 | ||
| 22 | for (;;) | 29 | for (;;) |
| 23 | { | 30 | { |
