diff options
-rw-r--r-- | chemist.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/chemist.cpp b/chemist.cpp index 8b00d12..06e1992 100644 --- a/chemist.cpp +++ b/chemist.cpp | |||
@@ -10,7 +10,14 @@ | |||
10 | 10 | ||
11 | int main(int argc, char** argv) | 11 | int main(int argc, char** argv) |
12 | { | 12 | { |
13 | YAML::Node config = YAML::LoadFile("config.yml"); | 13 | if (argc != 2) |
14 | { | ||
15 | std::cout << "usage: chemist [configfile]" << std::endl; | ||
16 | return -1; | ||
17 | } | ||
18 | |||
19 | std::string configfile(argv[1]); | ||
20 | YAML::Node config = YAML::LoadFile(configfile); | ||
14 | 21 | ||
15 | twitter::auth auth; | 22 | twitter::auth auth; |
16 | auth.setConsumerKey(config["consumer_key"].as<std::string>()); | 23 | auth.setConsumerKey(config["consumer_key"].as<std::string>()); |
@@ -21,10 +28,10 @@ int main(int argc, char** argv) | |||
21 | twitter::client client(auth); | 28 | twitter::client client(auth); |
22 | 29 | ||
23 | std::map<std::string, std::vector<std::string>> groups; | 30 | std::map<std::string, std::vector<std::string>> groups; |
24 | std::ifstream datafile("data.txt"); | 31 | std::ifstream datafile(config["forms_file"].as<std::string>()); |
25 | if (!datafile.is_open()) | 32 | if (!datafile.is_open()) |
26 | { | 33 | { |
27 | std::cout << "Could not find data.txt" << std::endl; | 34 | std::cout << "Could not find datafile" << std::endl; |
28 | return 1; | 35 | return 1; |
29 | } | 36 | } |
30 | 37 | ||
@@ -55,7 +62,7 @@ int main(int argc, char** argv) | |||
55 | std::random_device random_device; | 62 | std::random_device random_device; |
56 | std::mt19937 random_engine{random_device()}; | 63 | std::mt19937 random_engine{random_device()}; |
57 | 64 | ||
58 | verbly::data database {"data.sqlite3"}; | 65 | verbly::data database {config["verbly_datafile"].as<std::string>()}; |
59 | for (;;) | 66 | for (;;) |
60 | { | 67 | { |
61 | std::cout << "Generating tweet" << std::endl; | 68 | std::cout << "Generating tweet" << std::endl; |