public void When_read_Then_returns_environment_varible_value() { Environment.SetEnvironmentVariable(EnvironmentVariableName1, EnvironmentVariableValue1); var environmentVariableValue = _sut.Read(EnvironmentVariableName1); Assert.AreEqual(EnvironmentVariableValue1, environmentVariableValue); }
public async Task <ConfigurationModel> GetConfiguration(string path) { _stringValidator.IsNullOrWhitespace(path, nameof(path)); var configuration = await _configurationReader.Read(path); var environmentVariables = ExtractEnvironmentVariables(configuration); var environmentVariablesValues = _environmentVariableReader.Read(environmentVariables); configuration = ProcessEnvironmentVariables(configuration, environmentVariablesValues); return(configuration); }
public async Task <ProfileModel> GetProfile(string path) { _stringValidator.IsNullOrWhitespace(path, nameof(path)); var profile = await _profileReader.Read(path); var environmentVariables = _profileReader.ExtractEnvironmentVariables(profile); var environmentVariablesValues = _environmentVariableReader.Read(environmentVariables); profile = ProcessEnvironmentVariables(profile, environmentVariablesValues); return(profile); }
public async Task <TemplateModel> GetTemplate(string path) { _stringValidator.IsNullOrWhitespace(path, nameof(path)); var template = await _templateReader.Read(path); var environmentVariables = _templateReader.ExtractEnvironmentVariables(template); var environmentVariablesValues = _environmentVariableReader.Read(environmentVariables); template = ProcessEnvironmentVariables(template, environmentVariablesValues); return(template); }
public async Task <Pbkdf2Model> Decrypt(string path, string entropy) { _stringValidator.IsNullOrWhitespace(path, nameof(path)); _stringValidator.IsNullOrWhitespace(entropy, nameof(entropy)); _fileValidator.IsExist(path); var content = await _diskService.ReadFileText(path); var plaintext = _pbkdF2Service.Decrypt(content, entropy); var fields = ProcessFileHelper.ProcessContent(plaintext); var result = new Pbkdf2Model(fields); var environmentVariables = ProcessFileHelper.ExtractEnvironmentVariables(result.Fields); var environmentVariablesValues = _environmentVariableReader.Read(environmentVariables); result = ProcessEnvironmentVariables(result, environmentVariablesValues); return(result); }