seperate config file per profile (fixes race condition)
This commit is contained in:
parent
63b11121bb
commit
20a65e4330
|
@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 3.7)
|
|||
include(GNUInstallDirs)
|
||||
|
||||
project (rss2mastodon
|
||||
VERSION 0.1.3
|
||||
VERSION 0.1.4
|
||||
LANGUAGES CXX
|
||||
)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall")
|
||||
|
|
|
@ -45,7 +45,7 @@ void read_config(pt::ptree &config, const string &profile, string &instance, str
|
|||
|
||||
// Read config file, get access token
|
||||
try {
|
||||
pt::read_json(filepath + "config.json", config);
|
||||
pt::read_json(filepath + "config-" + profile + ".json", config);
|
||||
instance = config.get(profile + ".instance", "");
|
||||
access_token = config.get(profile + ".access_token", "");
|
||||
feedurl = config.get(profile + ".feedurl", "");
|
||||
|
@ -81,7 +81,7 @@ void read_config(pt::ptree &config, const string &profile, string &instance, str
|
|||
}
|
||||
if (config_changed)
|
||||
{
|
||||
pt::write_json(filepath + "config.json", config);
|
||||
pt::write_json(filepath + "config-" + profile + ".json", config);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -190,7 +190,7 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
config.put(profile + ".last_entry", entries.front());
|
||||
}
|
||||
pt::write_json(filepath + "config.json", config);
|
||||
pt::write_json(filepath + "config-" + profile + ".json", config);
|
||||
|
||||
bool new_content = false;
|
||||
for (auto rit = entries.rbegin(); rit != entries.rend(); ++rit)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef AFRINTICKER_HPP
|
||||
#define AFRINTICKER_HPP
|
||||
#ifndef RSS2MASTODON_HPP
|
||||
#define RSS2MASTODON_HPP
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
@ -16,4 +16,4 @@ std::vector<string> parse_website(const string &profile, const string &xml);
|
|||
const std::uint16_t http_get(const string &host, const string &path,
|
||||
string &answer, const string &useragent = "");
|
||||
|
||||
#endif // AFRINTICKER_HPP
|
||||
#endif // RSS2MASTODON_HPP
|
||||
|
|
Loading…
Reference in New Issue
Block a user