Default mount options for all volumes
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing

This commit is contained in:
2023-05-27 00:55:44 +02:00
parent c9c2115e83
commit c7adbd3f5d
2 changed files with 15 additions and 5 deletions

View File

@@ -78,6 +78,13 @@
"settable": [
"value"
]
},
{
"name": "OBJECTIVEFS_MOUNT_OPTIONS",
"value": "",
"settable": [
"value"
]
}
],
"network": {

13
main.go
View File

@@ -47,9 +47,10 @@ type ofsVolumeRt struct {
type ofsDriver struct {
sync.RWMutex
volumedb *bolt.DB
volumeRt map[string]*ofsVolumeRt
defEnv map[string]string
volumedb *bolt.DB
volumeRt map[string]*ofsVolumeRt
defEnv map[string]string
defMountOpt string
}
var version = "1.0"
@@ -76,7 +77,7 @@ func (d *ofsDriver) Create(r *volume.CreateRequest) error {
v := &ofsVolume{}
v.Volume = &volume.Volume{Name: r.Name, Mountpoint: filepath.Join(volume.DefaultDockerRootDirectory, "objectivefs", r.Name), CreatedAt: time.Now().Format(time.RFC3339Nano)}
v.Opts = ""
v.Opts = d.defMountOpt
v.Fs = r.Name
env := make(map[string]string)
for id, val := range d.defEnv {
@@ -367,6 +368,8 @@ func main() {
}
}
defMountOpt := os.Getenv("OBJECTIVEFS_MOUNT_OPTIONS")
db, err := bolt.Open("objectivefs.db", 0600, nil)
if err != nil {
log.Fatal(err)
@@ -380,7 +383,7 @@ func main() {
return nil
})
d := &ofsDriver{volumedb: db, volumeRt: make(map[string]*ofsVolumeRt), defEnv: defEnv}
d := &ofsDriver{volumedb: db, volumeRt: make(map[string]*ofsVolumeRt), defEnv: defEnv, defMountOpt: defMountOpt}
h := volume.NewHandler(d)
u, _ := user.Lookup("root")
gid, _ := strconv.Atoi(u.Gid)