From cf85cc3c774c16732b0309dcb5bfb0ab03f8bba8 Mon Sep 17 00:00:00 2001 From: Alexander Zhirov Date: Sat, 24 May 2025 01:33:42 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D0=BD=D0=BE=D0=B2=D1=8B=D0=B9=20=D0=BF=D0=B0=D1=80?= =?UTF-8?q?=D0=B0=D0=BC=D0=B5=D1=82=D1=80=20user=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BD=D1=84=D0=B8=D0=B3=D1=83=D1=80=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=B8=20git?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/snapd/config/config.d | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/source/snapd/config/config.d b/source/snapd/config/config.d index 5822758..e6d7f8f 100644 --- a/source/snapd/config/config.d +++ b/source/snapd/config/config.d @@ -12,6 +12,7 @@ class SnapdConfig { private string _git; private string _project; private string _email; + private string _user; private bool isValidEmail(string email) { auto emailPattern = ctRegex!r"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$"; @@ -85,9 +86,22 @@ class SnapdConfig { "Invalid email address provided in the \"email\" parameter:\n\t" ~ _email ); + + if ("user" !in jsonData) + throw new SnapdConfigException( + "The configuration file is missing the \"user\" parameter" + ); + + _user = jsonData["user"].str; + + if (!_user.length) + throw new SnapdConfigException( + "The \"user\" parameter must contain an user name" + ); } @property string git() const { return _git; } @property string project() const { return _project; } @property string email() const { return _email; } + @property string user() const { return _user; } }