set storage uid and gid.

This commit is contained in:
Miroslav Šedivý
2021-05-22 01:03:06 +02:00
parent e63c43e150
commit 51b527dace
2 changed files with 21 additions and 0 deletions
+6
View File
@@ -28,6 +28,8 @@ import (
const (
frontendPort = 8080
roomStoragePath = "./rooms"
roomStorageUid = 1000
roomStorageGid = 1000
)
func New(config *config.Room) *RoomManagerCtx {
@@ -207,6 +209,10 @@ func (manager *RoomManagerCtx) Create(settings types.RoomSettings) (string, erro
return "", err
}
if err := utils.ChownR(internalPath, roomStorageUid, roomStorageGid); err != nil {
return "", err
}
mounts = append(mounts,
dockerMount.Mount{
Type: dockerMount.TypeBind,
+15
View File
@@ -0,0 +1,15 @@
package utils
import (
"os"
"path/filepath"
)
func ChownR(path string, uid, gid int) error {
return filepath.Walk(path, func(name string, info os.FileInfo, err error) error {
if err == nil {
err = os.Chown(name, uid, gid)
}
return err
})
}