bwssytems/ha-bridge

HABridge loosing config

lollett opened this issue · 0 comments

I'm running HA-Bridge 5.4.1 in docker from DockerHub linuxserver/habridge:latest

Everything is working well except randomly it stops working because it's lost /config/ha-bridge.config
Either the file is zero length or completely missing...

There's no scripts in the docker image to suggest its doing anything, but coincidently I see a habridge.config.old-[date]-[time] created the same day it fails.

The only thing I can think might happing is the HA-Bridge code (below) is routinely creating this backup by moving the "ha-bridge.config to habridge.config.old-[date]-[time] " and failing to recreate "ha-bridge.config"

target = FileSystems.getDefault().getPath(filePath.getParent().toString(), "habridge.config.old." + getCurrentDate());
			Files.move(filePath, target);
		}
		Files.write(filePath, content.getBytes(), StandardOpenOption.CREATE);

It's probably a permission issue, but wouldn't it be safer to Files.copy instead of Files.move ???