Fix handling of docker.cfg and domain.cfg files.

This commit is contained in:
Tom Mortensen
2016-06-13 15:00:46 -07:00
parent 378fcc953d
commit da12336be9
5 changed files with 87 additions and 52 deletions

View File

@@ -33,28 +33,8 @@ if (!isset($eth0) && is_file("/usr/local/emhttp/state/network.ini")) {
extract(parse_ini_file('/usr/local/emhttp/state/network.ini',true));
}
$docker_cfg_defaults = [
"DOCKER_ENABLED" => "no",
"DOCKER_OPTS" => "--storage-driver=btrfs",
"DOCKER_IMAGE_SIZE" => "20",
"DOCKER_IMAGE_FILE" => "/mnt/user/system/docker/docker.img",
"DOCKER_APP_CONFIG_PATH" => "/mnt/user/appdata/",
"DOCKER_APP_UNRAID_PATH" => ""
];
$dockercfg = $docker_cfg_defaults;
// Docker configuration file - create if needed
$docker_cfgfile = "/boot/config/docker.cfg";
if (!file_exists($docker_cfgfile)) {
$tmp = '';
foreach ($docker_cfg_defaults as $key => $value) $tmp .= "$key=\"$value\"\n";
file_put_contents($docker_cfgfile, $tmp);
} else {
$docker_cfg_existing = parse_ini_file($docker_cfgfile);
if (!empty($docker_cfg_existing)) {
$dockercfg = array_merge($docker_cfg_defaults, $docker_cfg_existing);
}
}
// Docker configuration file - guaranteed to exist
$dockercfg = parse_ini_file("/boot/config/docker.cfg");
######################################
## DOCKERTEMPLATES CLASS ##