mirror of
https://github.com/eiblog/eiblog.git
synced 2026-02-08 07:42:27 +08:00
chore: update docs
This commit is contained in:
@@ -3,7 +3,7 @@ apimode:
|
||||
listen: 0.0.0.0:9000
|
||||
database: # 数据库配置
|
||||
driver: mongodb
|
||||
source: mongodb://localhost:27017
|
||||
source: mongodb://localhost:27017/eiblog
|
||||
backupto: qiniu # 备份到, default: qiniu
|
||||
interval: 7d # 备份周期, default: 7d
|
||||
validity: 60 # 备份保留时间, default: 60
|
||||
|
||||
@@ -24,14 +24,17 @@ func (r MongoStorage) Backup(name string) (string, error) {
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
arg := fmt.Sprintf("mongodump -h %s -d eiblog -o /tmp", u.Host)
|
||||
if u.Path == "" {
|
||||
return "", fmt.Errorf("no database specified")
|
||||
}
|
||||
arg := fmt.Sprintf("mongodump -h %s -d %s -o /tmp", u.Host, u.Path)
|
||||
cmd := exec.CommandContext(ctx, "sh", "-c", arg)
|
||||
err = cmd.Run()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
// tar
|
||||
arg = fmt.Sprintf("tar czf /tmp/%s -C /tmp eiblog", name)
|
||||
arg = fmt.Sprintf("tar czf /tmp/%s -C /tmp %s", name, u.Path)
|
||||
cmd = exec.CommandContext(ctx, "sh", "-c", arg)
|
||||
err = cmd.Run()
|
||||
if err != nil {
|
||||
@@ -66,7 +69,7 @@ func (r MongoStorage) Restore(path string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
arg = fmt.Sprintf("mongorestore -h %s -d eiblog /tmp/eiblog", u.Host)
|
||||
arg = fmt.Sprintf("mongorestore -h %s -d %s /tmp/%s", u.Host, u.Path, u.Path)
|
||||
cmd = exec.CommandContext(ctx, "sh", "-c", arg)
|
||||
return cmd.Run()
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
### [3.0.3](https://github.com/eiblog/eiblog/compare/v3.0.2...v3.0.3) (2025-07-25)
|
||||
Reference in New Issue
Block a user