1
0
mirror of https://github.com/go-kratos/kratos.git synced 2026-05-22 10:15:24 +02:00

feat: add backupConfigPath method (#1511)

* add backupConfigPath method

Co-authored-by: yangfw <yangfw@corp.21cn.com>
This commit is contained in:
ONG-YA
2021-10-06 13:11:24 +08:00
committed by GitHub
parent 3b477e7e52
commit a99659052a
+10
View File
@@ -20,6 +20,7 @@ type options struct {
endpoint string
namespace string
isBackupConfig bool
backupPath string
}
// WithAppID with apollo config app id
@@ -71,6 +72,14 @@ func WithNamespace(name string) Option {
}
}
// WithBackupPath with apollo config backupPath
func WithBackupPath(backupPath string) Option {
return func(o *options) {
o.backupPath = backupPath
}
}
func NewSource(opts ...Option) config.Source {
op := options{}
for _, o := range opts {
@@ -84,6 +93,7 @@ func NewSource(opts ...Option) config.Source {
IP: op.endpoint,
IsBackupConfig: op.isBackupConfig,
Secret: op.secret,
BackupConfigPath: op.backupPath,
}, nil
})
if err != nil {