fix protected mount & export mounts.

This commit is contained in:
Miroslav Šedivý
2023-10-06 21:49:35 +02:00
parent 6e8bcf90e9
commit 93c1e6fef8
+12 -2
View File
@@ -203,8 +203,16 @@ func (manager *RoomManagerCtx) ExportAsDockerCompose(ctx context.Context) ([]byt
} }
// volumes // volumes
if len(containerJson.HostConfig.Binds) > 0 { volumes := []string{}
service["volumes"] = containerJson.HostConfig.Binds for _, mount := range container.Mounts {
if !mount.RW {
volumes = append(volumes, fmt.Sprintf("%s:%s:ro", mount.Source, mount.Destination))
} else {
volumes = append(volumes, fmt.Sprintf("%s:%s", mount.Source, mount.Destination))
}
}
if len(volumes) > 0 {
service["volumes"] = volumes
} }
// devices // devices
@@ -705,6 +713,8 @@ func (manager *RoomManagerCtx) GetSettings(ctx context.Context, id string) (*typ
} else if strings.HasPrefix(hostPath, templateStorageRoot) { } else if strings.HasPrefix(hostPath, templateStorageRoot) {
mountType = types.MountTemplate mountType = types.MountTemplate
hostPath = strings.TrimPrefix(hostPath, templateStorageRoot) hostPath = strings.TrimPrefix(hostPath, templateStorageRoot)
} else if !mount.RW {
mountType = types.MountProtected
} }
mounts = append(mounts, types.RoomMount{ mounts = append(mounts, types.RoomMount{