Skip to content

Commit 36c2453

Browse files
committed
Tune configuration comparation
1 parent eeb520a commit 36c2453

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ Volumes listed in `iobBackup` are tagged for inclusion in ioBroker backup routin
180180
-->
181181

182182
## Changelog
183-
### 0.0.25 (2025-10-09)
183+
### **WORK IN PROGRESS**
184184
- (@GermanBluefox) Split the docker manager into pure docker commands and monitoring of own containers
185185

186186
### 0.0.3 (2025-09-25)

src/lib/DockerManagerOfOwnContainers.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ function deepCompare(object1: any, object2: any): boolean {
5252
const keys1 = Object.keys(object1);
5353
for (const key of keys1) {
5454
// ignore iob* properties as they belong to ioBroker configuration
55-
// ignore hostname
56-
if (key.startsWith('iob') || key === 'hostname') {
55+
// ignore hostname and dependsOn as it is only for docker-compose
56+
if (key.startsWith('iob') || key === 'hostname' || key === 'dependsOn') {
5757
continue;
5858
}
5959
if (!deepCompare(object1[key], object2[key])) {
@@ -71,8 +71,8 @@ function compareConfigs(desired: ContainerConfig, existing: ContainerConfig): st
7171
// We only compare keys that are in the desired config
7272
for (const key of keys) {
7373
// ignore iob* properties as they belong to ioBroker configuration
74-
// ignore hostname
75-
if (key.startsWith('iob') || key === 'hostname') {
74+
// ignore hostname and dependsOn as it is only for docker-compose
75+
if (key.startsWith('iob') || key === 'hostname' || key === 'dependsOn') {
7676
continue;
7777
}
7878
if (typeof desired[key] === 'object' && desired[key] !== null) {

src/lib/compose2config.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,17 @@ export function composeServiceToContainerConfig(serviceName: string | undefined,
382382
throw new Error(`Service ${serviceName} not found in compose file`);
383383
}
384384
const env = normalizeEnv(svc.environment);
385+
// Replace all true/false and numbers with strings, as docker API expects strings
386+
if (env) {
387+
for (const k of Object.keys(env)) {
388+
if (typeof env[k] === 'boolean') {
389+
env[k] = env[k] ? 'true' : 'false';
390+
} else if (typeof env[k] === 'number') {
391+
env[k] = String(env[k]);
392+
}
393+
}
394+
}
395+
385396
const ports = mapPorts(svc.ports);
386397
const { mounts, tmpfs } = mapVolumes(svc.volumes, compose.volumes);
387398
const devices = mapDevices(svc.devices);

0 commit comments

Comments
 (0)