diff --git a/src/GitlabCLI.Console/Configuration/AppSettingsStorage.cs b/src/GitlabCLI.Console/Configuration/AppSettingsStorage.cs index 5e79080..7bba36d 100644 --- a/src/GitlabCLI.Console/Configuration/AppSettingsStorage.cs +++ b/src/GitlabCLI.Console/Configuration/AppSettingsStorage.cs @@ -19,7 +19,17 @@ public AppSettingsStorage(JsonSerializer serializer, string settingsFile, Encryp _encryptor = encryptor; } + public AppSettings LoadWithSensitiveDataEncrypted() + => LoadSettingsFromFile(); + public AppSettings Load() + { + var settings = LoadSettingsFromFile(); + DecryptSensitiveData(settings); + return settings; + } + + private AppSettings LoadSettingsFromFile() { EnsureSettingsDirectoryExists(); @@ -29,9 +39,7 @@ public AppSettings Load() using (var settingsStream = File.OpenText(_settingsFile)) using (var textReader = new JsonTextReader(settingsStream)) { - var settings = _serializer.Deserialize(textReader) ?? new AppSettings(); - DecryptSensitiveData(settings); - return settings; + return _serializer.Deserialize(textReader) ?? new AppSettings(); } } diff --git a/src/GitlabCLI.Console/Configuration/ConfigurationHandler.cs b/src/GitlabCLI.Console/Configuration/ConfigurationHandler.cs index ca976ec..1499220 100644 --- a/src/GitlabCLI.Console/Configuration/ConfigurationHandler.cs +++ b/src/GitlabCLI.Console/Configuration/ConfigurationHandler.cs @@ -32,7 +32,8 @@ public void StoreConfiguration(ConfigurationParameters parameters) if (SaveConfigurationValues(parameters, settings)) _outputPresenter.ShowMessage("Configuration saved successfully."); - ShowConfiguration(settings); + var encryptedSettings = _storage.LoadWithSensitiveDataEncrypted(); + ShowConfiguration(encryptedSettings); } private void ShowConfiguration(AppSettings settings)