From 9f8e4f5b1dc3a71f615edafb7352825ef696724b Mon Sep 17 00:00:00 2001 From: mishamyrt Date: Fri, 29 Dec 2023 23:22:16 +0300 Subject: [PATCH] fix: create config if missing --- app/internal/repository/settings/file.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/internal/repository/settings/file.go b/app/internal/repository/settings/file.go index 8ee1023b..83a59def 100644 --- a/app/internal/repository/settings/file.go +++ b/app/internal/repository/settings/file.go @@ -58,6 +58,11 @@ func FromPath(directory string) (*File, error) { DirPath: directory, Name: "settings.json", } - err := file.Read() - return &file, err + if file.Read() != nil { + err := file.Write() + if err != nil { + return nil, err + } + } + return &file, nil }