mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 10:27:46 +08:00
fix(fsrepo): add guard to ConfigKey methods
This commit is contained in:
parent
3986af7691
commit
b54c7de48c
@ -110,6 +110,9 @@ func (r *FSRepo) SetConfig(conf *config.Config) error {
|
||||
|
||||
// GetConfigKey retrieves only the value of a particular key
|
||||
func (r *FSRepo) GetConfigKey(key string) (interface{}, error) {
|
||||
if r.state != opened {
|
||||
return nil, debugerror.Errorf("repo is %s", r.state)
|
||||
}
|
||||
filename, err := config.Filename(r.path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -123,6 +126,9 @@ func (r *FSRepo) GetConfigKey(key string) (interface{}, error) {
|
||||
|
||||
// SetConfigKey writes the value of a particular key
|
||||
func (r *FSRepo) SetConfigKey(key string, value interface{}) error {
|
||||
if r.state != opened {
|
||||
return debugerror.Errorf("repo is %s", r.state)
|
||||
}
|
||||
filename, err := config.Filename(r.path)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Loading…
Reference in New Issue
Block a user