Begin removing several dependencies on Config object

此提交包含在:
2019-09-29 17:12:36 +02:00
父節點 327c0793d1
當前提交 364d82a99f
共有 9 個檔案被更改,包括 127 行新增79 行删除

查看文件

@ -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);