mirror of
https://github.com/chylex/Nextcloud-News.git
synced 2025-04-10 04:15:42 +02:00
improve file_from_env script
Signed-off-by: Benjamin Brahmer <info@b-brahmer.de>
This commit is contained in:
parent
b48bb5b347
commit
4effa5fd8f
@ -13,12 +13,17 @@
|
|||||||
if ($argc < 2) {
|
if ($argc < 2) {
|
||||||
echo "This script expects two parameters:\n";
|
echo "This script expects two parameters:\n";
|
||||||
echo "./file_from_env.php ENV_VAR PATH_TO_FILE\n";
|
echo "./file_from_env.php ENV_VAR PATH_TO_FILE\n";
|
||||||
exit;
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Read environment variable
|
# Read environment variable
|
||||||
$content = getenv($argv[1]);
|
$content = getenv($argv[1]);
|
||||||
|
|
||||||
|
if (!$content){
|
||||||
|
echo "Variable was empty\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
file_put_contents($argv[2], $content);
|
file_put_contents($argv[2], $content);
|
||||||
|
|
||||||
echo "Done...\n";
|
echo "Done...\n";
|
Loading…
Reference in New Issue
Block a user