mirror of
https://github.com/XShengTech/MEGREZ.git
synced 2026-01-13 16:47:16 +08:00
[Feat] ✨ Add Mount Point Setting
This commit is contained in:
parent
a6d4d48cf3
commit
cfbd7d24db
@ -12,3 +12,4 @@ redis:
|
||||
port: 6379
|
||||
system:
|
||||
verify: false
|
||||
mount_dir: /path/to/mount
|
||||
|
||||
@ -41,8 +41,9 @@ type logStruct struct {
|
||||
}
|
||||
|
||||
type systemStruct struct {
|
||||
Salt string `yaml:"salt,omitempty"`
|
||||
Verify bool `yaml:"verify,omitempty"`
|
||||
Salt string `yaml:"salt,omitempty"`
|
||||
Verify bool `yaml:"verify,omitempty"`
|
||||
MountDir string `yaml:"mount_dir,omitempty"`
|
||||
}
|
||||
|
||||
var config = configStruct{
|
||||
|
||||
@ -53,6 +53,10 @@ func GetSystemVerify() bool {
|
||||
return config.GetSystemVerify()
|
||||
}
|
||||
|
||||
func GetSystemMountDir() string {
|
||||
return config.GetSystemMountDir()
|
||||
}
|
||||
|
||||
func Save() error {
|
||||
return config.Save()
|
||||
}
|
||||
|
||||
@ -40,6 +40,10 @@ func (c *configStruct) GetSystemVerify() bool {
|
||||
return c.System.Verify
|
||||
}
|
||||
|
||||
func (c *configStruct) GetSystemMountDir() string {
|
||||
return c.System.MountDir
|
||||
}
|
||||
|
||||
func (c *configStruct) Save() error {
|
||||
return c.save()
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ import (
|
||||
"errors"
|
||||
"megrez/libs/crypto"
|
||||
"megrez/libs/request"
|
||||
"megrez/services/config"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
@ -56,13 +57,16 @@ func createInstance(ip string, port int, apikey string,
|
||||
Src: volumeName,
|
||||
Dest: "/root/megrez-tmp",
|
||||
},
|
||||
{
|
||||
Src: "/data/pub",
|
||||
Dest: "/root/megrez-pub",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
if config.GetSystemMountDir() != "" {
|
||||
data.Binds = append(data.Binds, bindStruct{
|
||||
Src: config.GetSystemMountDir(),
|
||||
Dest: "/root/megrez",
|
||||
})
|
||||
}
|
||||
|
||||
reqBytes, err := json.Marshal(data)
|
||||
if err != nil {
|
||||
l.Error("marshal request data error: %v", err)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user