summaryrefslogtreecommitdiff
path: root/src/management/builder/settings.cpp
diff options
context:
space:
mode:
authorclaiff <claiff@mail.ru>2022-10-06 12:26:45 +0300
committerclaiff <claiff@mail.ru>2022-10-06 12:26:45 +0300
commitda5f91a0ce15351a82beb061c3ccc965164529bc (patch)
tree1f4cd2d1e2f8cf2442d055c519d06c6e0692febc /src/management/builder/settings.cpp
parent8edef99a5b52643e0b919c424357752cbbc9a8dd (diff)
downloadobmc-sila-smtp-bugfix/proxy_file_reader.tar.xz
create settings on startbugfix/proxy_file_reader
Diffstat (limited to 'src/management/builder/settings.cpp')
-rw-r--r--src/management/builder/settings.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/management/builder/settings.cpp b/src/management/builder/settings.cpp
index b682c49..bf345e7 100644
--- a/src/management/builder/settings.cpp
+++ b/src/management/builder/settings.cpp
@@ -4,6 +4,7 @@
#include "file/settings/settings.hpp"
#include "file/settings/checker_decorator.hpp"
#include "file/settings/file_decorator.hpp"
+#include "file/errors/not_create.hpp"
namespace smtp::manage::builder
{
@@ -17,12 +18,20 @@ namespace smtp::manage::builder
{
static const std::string PATH = "/var/lib/smtp/settings.txt";
- auto result = std::make_shared<file::settings::CheckerDecorator>(BuildErrorRegistrator());
- result->Apply(std::make_shared<file::settings::FileDecorator>(PATH));
+ auto result = std::make_shared<file::settings::CheckerDecorator>(BuildSettingsErrorRegistrator());
+ result->Apply(std::make_shared<file::settings::FileDecorator>(PATH, BuildFileErrorRegistrator(PATH)));
return result;
}
- checker::RegistratorSettings Settings::BuildErrorRegistrator() const
+ file::errors::Registrator Settings::BuildFileErrorRegistrator( std::string const& path ) const
+ {
+ file::errors::Registrator result;
+ auto not_created_file_error = std::make_shared<file::errors::NotCreatedFile>(path);
+ result.Add(not_created_file_error, ENOENT);
+ return result;
+ }
+
+ checker::RegistratorSettings Settings::BuildSettingsErrorRegistrator() const
{
checker::RegistratorSettings result;