refactor: optimize driver initialization need to manually deserialize and assign values, and remove redundant driver registration parameters (#2691)
* refactor: optimize driver initialization need to manually deserialize and assign values, and remove redundant driver registration parameters * fix typo Co-authored-by: Noah Hsu <i@nn.ci>
This commit is contained in:
@ -34,12 +34,7 @@ func (d *Local) Config() driver.Config {
|
||||
return config
|
||||
}
|
||||
|
||||
func (d *Local) Init(ctx context.Context, storage model.Storage) error {
|
||||
d.Storage = storage
|
||||
err := utils.Json.UnmarshalFromString(d.Storage.Addition, &d.Addition)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
func (d *Local) Init(ctx context.Context) (err error) {
|
||||
if !utils.Exists(d.GetRootPath()) {
|
||||
err = fmt.Errorf("root folder %s not exists", d.GetRootPath())
|
||||
} else {
|
||||
@ -59,7 +54,7 @@ func (d *Local) Drop(ctx context.Context) error {
|
||||
}
|
||||
|
||||
func (d *Local) GetAddition() driver.Additional {
|
||||
return d.Addition
|
||||
return &d.Addition
|
||||
}
|
||||
|
||||
func (d *Local) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([]model.Obj, error) {
|
||||
|
Reference in New Issue
Block a user