update: update config
This commit is contained in:
parent
0d8992a5c3
commit
95d134c2ec
19
config.yml
19
config.yml
@ -0,0 +1,19 @@
|
|||||||
|
robotfs:
|
||||||
|
address: "0.0.0.0:6201"
|
||||||
|
log_path: "/var/log/robotfs"
|
||||||
|
|
||||||
|
redis:
|
||||||
|
address: "localhost:6379"
|
||||||
|
password: ""
|
||||||
|
db: 0
|
||||||
|
|
||||||
|
s3:
|
||||||
|
region: "us-east-1"
|
||||||
|
endpoint: "http://localhost:9000"
|
||||||
|
access_key_id: "minioadmin"
|
||||||
|
secret_access_key: "minioadmin"
|
||||||
|
bucket_name: "robotfs"
|
||||||
|
use_path_style: true
|
||||||
|
|
||||||
|
juicefs:
|
||||||
|
data_path: "/data/juicefs"
|
||||||
@ -8,7 +8,9 @@ type RobotFSConfig struct {
|
|||||||
type RedisConfig struct {
|
type RedisConfig struct {
|
||||||
Address string `mapstructure:"address"`
|
Address string `mapstructure:"address"`
|
||||||
Password string `mapstructure:"password"`
|
Password string `mapstructure:"password"`
|
||||||
DB int `mapstructure:"db"`
|
DataBase int `mapstructure:"database"`
|
||||||
|
//Todo: use it in the future
|
||||||
|
SuperLargeDirectories []string `mapstructure:"superLargeDirectories"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type S3Config struct {
|
type S3Config struct {
|
||||||
@ -20,10 +22,16 @@ type S3Config struct {
|
|||||||
UsePathStyle bool `mapstructure:"use_path_style"`
|
UsePathStyle bool `mapstructure:"use_path_style"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type JuicefsConfig struct {
|
||||||
|
//Address string `mapstructure:"address"`
|
||||||
|
DataPath string `mapstructure:"data_path"`
|
||||||
|
}
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
RobotFS RobotFSConfig `mapstructure:"robotfs"`
|
RobotFS RobotFSConfig `mapstructure:"robotfs"`
|
||||||
Redis RedisConfig `mapstructure:"redis"`
|
Redis RedisConfig `mapstructure:"redis"`
|
||||||
S3 S3Config `mapstructure:"s3"`
|
S3 S3Config `mapstructure:"s3"`
|
||||||
|
Juicefs JuicefsConfig `mapstructure:"juicefs"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetConfig() *Config {
|
func GetConfig() *Config {
|
||||||
|
|||||||
16
utils/operation.go
Normal file
16
utils/operation.go
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
package utils
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os/exec"
|
||||||
|
)
|
||||||
|
|
||||||
|
func CloneFile(src, dst string) error {
|
||||||
|
cmd := exec.Command("juicefs", "clone", src, dst)
|
||||||
|
output, err := cmd.CombinedOutput()
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("clone failed: %v, output: %s", err, string(output))
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user