Skip to content

Commit

Permalink
Merge pull request RamonSilva20#2492 from juliolobo/Verificando-se-a-…
Browse files Browse the repository at this point in the history
…variável-de-ambiente-existe-no-.env-antes-de-tentar-alterar

Verifica se existe a variável no .env antes de tentar modificar
  • Loading branch information
willph authored Jul 18, 2024
2 parents d14fb8f + 58b7cac commit 7475d7b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion application/controllers/Mapos.php
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,12 @@ private function editDontEnv(array $data)
$valor = '"' . $base64 . '"';
$env_file = str_replace("$constante=" . '"' . $_ENV[$constante] . '"', "$constante={$valor}", $env_file);
} else {
$env_file = str_replace("$constante={$_ENV[$constante]}", "$constante={$valor}", $env_file);
if (isset($_ENV[$constante])) {
$env_file = str_replace("$constante={$_ENV[$constante]}", "$constante={$valor}", $env_file);
} else {
file_put_contents($env_file_path, $env_file . "\n{$constante}={$valor}\n");
$env_file = file_get_contents($env_file_path);
}
}
}
return file_put_contents($env_file_path, $env_file) ? true : false;
Expand Down

0 comments on commit 7475d7b

Please sign in to comment.