Skip to content

Commit

Permalink
Revert Home Assistant configuration to /config (#4697)
Browse files Browse the repository at this point in the history
* Revert Home Assistant configuration to `/config`

With the new add-on config feature the intention is to provide a good
location for add-on specific configurations. Currently, add-ons such
as Node RED or ESPHome use the Home Assistant config directory because
this location is accessible to the user (via Samba VSCode add-on etc.).

To make it clear to add-on developer that the new intention is to use
add-on specific config, the implementation now bind mounts the add-on
configuration directory to `/config`. And since some add-ons still need
access to the Home Assistant configuration, its config folder is mounted
to `/homeassistant` under the new scheme.

However, users do know the path `/config`, and edit things e.g. through
the SSH or VS Code add-on. Also `/config` is still the
directory from inside the Core container.

For SSH/VS Code add-on we could work around using a symlink, but that
only works as long as these add-ons don't have a add-on config
themselfs.

This all has very high confusion potential, for not much gain. The
renaming is mainly "developer friendly", but not really user friendly.

Let's minimize potential confusion, and keep things where they are.
The Home Assistant config directory stays at `/config, in all cases,
everwhere.

Map the new add-on configuration directory to `/addon_config`.

* Adjust tests/comments
  • Loading branch information
agners authored Nov 11, 2023
1 parent 5f45810 commit 16b71a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions supervisor/docker/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,18 +360,18 @@ def mounts(self) -> list[Mount]:
Mount(
type=MountType.BIND,
source=self.addon.path_extern_config.as_posix(),
target="/config",
target="/addon_config",
read_only=addon_mapping[MAP_ADDON_CONFIG],
)
)

# Map Home Assistant config in new way
# Map Home Assistant config using the new mapping to /config still
if MAP_HOMEASSISTANT_CONFIG in addon_mapping:
mounts.append(
Mount(
type=MountType.BIND,
source=self.sys_config.path_extern_homeassistant.as_posix(),
target="/homeassistant",
target="/config",
read_only=addon_mapping[MAP_HOMEASSISTANT_CONFIG],
)
)
Expand Down
6 changes: 3 additions & 3 deletions tests/docker/test_addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,12 @@ def test_addon_map_homeassistant_folder(
config["map"].append("homeassistant_config")
docker_addon = get_docker_addon(coresys, addonsdata_system, config)

# Home Assistant config folder mounted to /homeassistant, not /config
# Home Assistant config folder still mounted to /config
assert (
Mount(
type="bind",
source=coresys.config.path_extern_homeassistant.as_posix(),
target="/homeassistant",
target="/config",
read_only=True,
)
in docker_addon.mounts
Expand Down Expand Up @@ -194,7 +194,7 @@ def test_addon_map_addon_config_folder(
Mount(
type="bind",
source=docker_addon.addon.path_extern_config.as_posix(),
target="/config",
target="/addon_config",
read_only=True,
)
in docker_addon.mounts
Expand Down

0 comments on commit 16b71a2

Please sign in to comment.