mirror of
https://github.com/m1k1o/neko-rooms.git
synced 2026-11-02 22:51:34 -06:00
set storage uid and gid.
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user