Пример #1
0
func NewPluginConfig(errorHandler func(error)) *PluginConfig {
	pluginPath := filepath.Join(config_helpers.PluginRepoDir(), ".cf", "plugins")
	return &PluginConfig{
		data:       NewData(),
		mutex:      new(sync.RWMutex),
		initOnce:   new(sync.Once),
		persistor:  configuration.NewDiskPersistor(filepath.Join(pluginPath, "config.json")),
		onError:    errorHandler,
		pluginPath: pluginPath,
	}
}
Пример #2
0
func NewRepositoryFromFilepath(filepath string, errorHandler func(error)) Repository {
	return NewRepositoryFromPersistor(configuration.NewDiskPersistor(filepath), errorHandler)
}