Begin removing several dependencies on Config object
此提交包含在:
14
qswiki.cpp
14
qswiki.cpp
@ -56,12 +56,12 @@ void setup_signal_handlers()
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<ICache> createCache(const Config &config)
|
||||
std::unique_ptr<ICache> createCache(const ConfigVariableResolver &resolver)
|
||||
{
|
||||
|
||||
std::string path = config.getConfig("cache_fs_dir");
|
||||
std::string path = resolver.getConfig("cache_fs_dir");
|
||||
|
||||
return std::make_unique<FsCache>(config.getConfig("cache_fs_dir"));
|
||||
return std::make_unique<FsCache>(path);
|
||||
}
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
@ -97,7 +97,7 @@ int main(int argc, char **argv)
|
||||
// TODO: config.connectiontring only works as long as we only support sqlite of course
|
||||
|
||||
if(!sandbox->enablePreWorker({
|
||||
config.getConfig("cache_fs_dir"),
|
||||
config.configVarResolver.getConfig("cache_fs_dir"),
|
||||
config.templatepath,
|
||||
std::filesystem::path(config.logfile).parent_path(),
|
||||
std::filesystem::path(config.connectionstring).parent_path(),
|
||||
@ -130,10 +130,10 @@ int main(int argc, char **argv)
|
||||
userdao->save(anon.value());
|
||||
User::setAnon(anon.value());
|
||||
|
||||
Template siteTemplate{config};
|
||||
UrlProvider urlprovider{config};
|
||||
Template siteTemplate{config.templateprefix, config.templatepath, config.urls, config.configVarResolver};
|
||||
UrlProvider urlprovider{config.urls};
|
||||
|
||||
auto cache = createCache(config);
|
||||
auto cache = createCache(config.configVarResolver);
|
||||
cache->clear();
|
||||
RequestWorker requestWorker(*database, siteTemplate, urlprovider, *cache);
|
||||
|
||||
|
新增問題並參考
封鎖使用者