Update label overrides implementation

This commit is contained in:
Svilen Markov
2025-04-26 17:39:05 +01:00
parent 51e70347e4
commit bba2c5b20c
3 changed files with 142 additions and 109 deletions

View File

@@ -1701,11 +1701,8 @@ Display the status of your Docker containers along with an icon and an optional
```yaml
- type: docker-containers
hide-by-default: false
readable-names: false
```
The `readable-names` will try to auto format your container names by capitalizing the first letter and converting `-` and `_` characters to spaces.
> [!NOTE]
>
> The widget requires access to `docker.sock`. If you're running Glance inside a container, this can be done by mounting the socket as a volume:
@@ -1730,18 +1727,16 @@ Configuration of the containers is done via labels applied to each container:
glance.description: Movies & shows
```
Configuration of the containers can also be overridden using `glance.yml`. Containers are specified by their container names, these will take preference over any docker labels that are set:
Alternatively, you can also define the values within your `glance.yml` via the `containers` property, where the key is the container name and each value is the same as the labels but without the "glance." prefix:
```yaml
- type: docker-containers
hide-by-default: false
readable-names: false
containers: # Alternative to using docker labels
container_name_1: # This is the actual container name
title: "Test Container Name"
description: "test-description"
url: "127.0.0.1:3011/test"
icon: "si:jellyfin"
containers:
container_name_1:
title: Container Name
description: Description of the container
url: https://container.domain.com
icon: si:container-icon
hide: false
```
@@ -1796,11 +1791,15 @@ If any of the child containers are down, their status will propagate up to the p
| Name | Type | Required | Default |
| ---- | ---- | -------- | ------- |
| hide-by-default | boolean | no | false |
| format-container-names | boolean | no | false |
| sock-path | string | no | /var/run/docker.sock |
##### `hide-by-default`
Whether to hide the containers by default. If set to `true` you'll have to manually add a `glance.hide: false` label to each container you want to display. By default all containers will be shown and if you want to hide a specific container you can add a `glance.hide: true` label.
##### `format-container-names`
When set to `true`, automatically converts container names such as `container_name_1` into `Container Name 1`.
##### `sock-path`
The path to the Docker socket.