mirror of
https://github.com/yv1ing/MollyBlog.git
synced 2025-09-16 14:53:45 +08:00
new: Added the option to automatically pull in the configuration
This commit is contained in:
@@ -12,6 +12,7 @@ storage:
|
|||||||
src: _post/src
|
src: _post/src
|
||||||
dst: _post/dst
|
dst: _post/dst
|
||||||
type: COS
|
type: COS
|
||||||
|
auto_pull: true
|
||||||
cos:
|
cos:
|
||||||
appid:
|
appid:
|
||||||
bucket:
|
bucket:
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ type mStorage struct {
|
|||||||
DST string `yaml:"dst"`
|
DST string `yaml:"dst"`
|
||||||
Type string `yaml:"type"`
|
Type string `yaml:"type"`
|
||||||
COS cosConfig `yaml:"cos"`
|
COS cosConfig `yaml:"cos"`
|
||||||
|
AutoPull bool `yaml:"auto_pull"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type cosConfig struct {
|
type cosConfig struct {
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ func (ma *MApp) loadMarkdownFiles() error {
|
|||||||
|
|
||||||
markdownPath := ma.Config.Storage.SRC
|
markdownPath := ma.Config.Storage.SRC
|
||||||
|
|
||||||
|
if ma.Config.Storage.AutoPull {
|
||||||
switch ma.Config.Storage.Type {
|
switch ma.Config.Storage.Type {
|
||||||
case "COS":
|
case "COS":
|
||||||
err = storage.CosLoadMarkdowns(*ma.Config, markdownPath)
|
err = storage.CosLoadMarkdowns(*ma.Config, markdownPath)
|
||||||
@@ -32,6 +33,7 @@ func (ma *MApp) loadMarkdownFiles() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
err = filepath.Walk(markdownPath, func(path string, info os.FileInfo, err error) error {
|
err = filepath.Walk(markdownPath, func(path string, info os.FileInfo, err error) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user