|
|
|
@ -11,6 +11,7 @@ type apollo struct { |
|
|
|
|
client *agollo.Client |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Option is apollo option
|
|
|
|
|
type Option func(*options) |
|
|
|
|
|
|
|
|
|
type options struct { |
|
|
|
@ -20,7 +21,7 @@ type options struct { |
|
|
|
|
endpoint string |
|
|
|
|
namespace string |
|
|
|
|
isBackupConfig bool |
|
|
|
|
backupPath string |
|
|
|
|
backupPath string |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// WithAppID with apollo config app id
|
|
|
|
@ -72,7 +73,6 @@ func WithNamespace(name string) Option { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// WithBackupPath with apollo config backupPath
|
|
|
|
|
func WithBackupPath(backupPath string) Option { |
|
|
|
|
return func(o *options) { |
|
|
|
@ -87,12 +87,12 @@ func NewSource(opts ...Option) config.Source { |
|
|
|
|
} |
|
|
|
|
client, err := agollo.StartWithConfig(func() (*apolloConfig.AppConfig, error) { |
|
|
|
|
return &apolloConfig.AppConfig{ |
|
|
|
|
AppID: op.appid, |
|
|
|
|
Cluster: op.cluster, |
|
|
|
|
NamespaceName: op.namespace, |
|
|
|
|
IP: op.endpoint, |
|
|
|
|
IsBackupConfig: op.isBackupConfig, |
|
|
|
|
Secret: op.secret, |
|
|
|
|
AppID: op.appid, |
|
|
|
|
Cluster: op.cluster, |
|
|
|
|
NamespaceName: op.namespace, |
|
|
|
|
IP: op.endpoint, |
|
|
|
|
IsBackupConfig: op.isBackupConfig, |
|
|
|
|
Secret: op.secret, |
|
|
|
|
BackupConfigPath: op.backupPath, |
|
|
|
|
}, nil |
|
|
|
|
}) |
|
|
|
|