Files
webgui/emhttp/plugins/dynamix.docker.manager/scripts/dockerconfig
Tom Mortensen 90cbff0058 Docker and libvirt disabled by default.
Permit removing unRAID array if no devices assigned.
2024-06-24 23:28:52 -07:00

41 lines
1.2 KiB
PHP
Executable File

#!/usr/bin/php -q
<?PHP
/* Copyright 2015-2024, Lime Technology
* Copyright 2015-2016, Guilherme Jardim, Eric Schultz, Jon Panozzo.
* Copyright 2012-2023, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*/
?>
<?
$cfgfile = "/boot/config/docker.cfg";
$cfg_defaults = [
"DOCKER_ENABLED" => "no",
"DOCKER_NETWORK_TYPE" => "1",
"DOCKER_IMAGE_FILE" => "/mnt/user/system/docker/docker.img",
"DOCKER_IMAGE_SIZE" => "20",
"DOCKER_APP_CONFIG_PATH" => "/mnt/user/appdata/",
"DOCKER_APP_UNRAID_PATH" => "",
"DOCKER_READMORE" => "yes"
];
$cfg_new = $cfg_defaults;
if (file_exists($cfgfile)) {
$cfg_old = parse_ini_file($cfgfile);
if (!empty($cfg_old)) {
$cfg_new = array_merge($cfg_defaults, $cfg_old);
if (empty(array_diff($cfg_new, $cfg_old))) unset($cfg_new);
}
}
if (isset($cfg_new)) {
$tmp = '';
foreach ($cfg_new as $key => $value) $tmp .= "$key=\"$value\"\n";
file_put_contents($cfgfile, $tmp);
}
?>