Skip to content

Commit

Permalink
fix protected mount & export mounts.
Browse files Browse the repository at this point in the history
  • Loading branch information
m1k1o committed Oct 6, 2023
1 parent 6e8bcf9 commit 93c1e6f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions internal/room/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,16 @@ func (manager *RoomManagerCtx) ExportAsDockerCompose(ctx context.Context) ([]byt
}

// volumes
if len(containerJson.HostConfig.Binds) > 0 {
service["volumes"] = containerJson.HostConfig.Binds
volumes := []string{}
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
Expand Down Expand Up @@ -705,6 +713,8 @@ func (manager *RoomManagerCtx) GetSettings(ctx context.Context, id string) (*typ
} else if strings.HasPrefix(hostPath, templateStorageRoot) {
mountType = types.MountTemplate
hostPath = strings.TrimPrefix(hostPath, templateStorageRoot)
} else if !mount.RW {
mountType = types.MountProtected
}

mounts = append(mounts, types.RoomMount{
Expand Down

0 comments on commit 93c1e6f

Please sign in to comment.