1
0
mirror of https://github.com/chylex/Nextcloud-News.git synced 2024-11-24 13:42:47 +01:00
Nextcloud-News/bin/tools/file_from_env.php
Benjamin Brahmer 4effa5fd8f improve file_from_env script
Signed-off-by: Benjamin Brahmer <info@b-brahmer.de>
2021-02-10 16:12:41 +01:00

29 lines
571 B
PHP
Executable File

#!/usr/bin/env php
<?php
/**
* Nextcloud - News
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Benjamin Brahmer <info@b-brahmer.de>
* @copyright Benjamin Brahmer 2020
*/
if ($argc < 2) {
echo "This script expects two parameters:\n";
echo "./file_from_env.php ENV_VAR PATH_TO_FILE\n";
exit(1);
}
# Read environment variable
$content = getenv($argv[1]);
if (!$content){
echo "Variable was empty\n";
exit(1);
}
file_put_contents($argv[2], $content);
echo "Done...\n";