Example #1
0
func setConfig(r repo.Repo, key string, value interface{}) (*ConfigField, error) {
	err := r.SetConfigKey(key, value)
	if err != nil {
		return nil, fmt.Errorf("Failed to set config value: %s (maybe use --json?)", err)
	}
	return getConfig(r, key)
}
Example #2
0
func setConfig(r repo.Repo, key string, value interface{}) (*ConfigField, error) {
	keyF, err := getConfig(r, "Identity.PrivKey")
	if err != nil {
		return nil, errors.New("failed to get PrivKey")
	}
	privkey := keyF.Value
	err = r.SetConfigKey(key, value)
	if err != nil {
		return nil, fmt.Errorf("failed to set config value: %s (maybe use --json?)", err)
	}
	err = r.SetConfigKey("Identity.PrivKey", privkey)
	if err != nil {
		return nil, errors.New("failed to set PrivKey")
	}
	return getConfig(r, key)
}
Example #3
0
func extendConfigFile(r repo.Repo, key string, value interface{}) error {
	if err := r.SetConfigKey(key, value); err != nil {
		return err
	}
	return nil
}