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; } }