TShell.AddEnvironment#
Adiciona ou substitui uma variável de ambiente. Aceita texto comum ou uma referência TSecret autorizada para ambiente de processo.
Declaração#
function AddEnvironment(const AName: String; const AValue: String): TShell;
function AddEnvironment(const AName: String; const AValue: TSecret): TShell;Exemplo#
program Exemplo(Config: TConfig);
uses Odisseia.Process;
var
Shell: TShell;
Secret: TSecret;
begin
Shell := TShell.Create;
Shell.Executable := Config.GetString('SHELL_EXECUTABLE');
Secret := Config.GetSecret('deploy.token');
Shell.Command := 'echo hello';
Shell.AddEnvironment('LANG', 'pt_BR.UTF-8');
Shell.AddEnvironment('DEPLOY_TOKEN', Secret);
end.A sobrecarga secreta exige secret.use e secret.shell.use. Um valor novo com o mesmo nome substitui o anterior sem expor o segredo.