2016-11-16 13:47:49 +00:00
|
|
|
package inmem
|
|
|
|
|
2017-02-01 17:20:50 +00:00
|
|
|
import "github.com/kolide/kolide/server/kolide"
|
2016-11-16 13:47:49 +00:00
|
|
|
|
2016-12-16 00:12:43 +00:00
|
|
|
func (d *Datastore) NewAppConfig(info *kolide.AppConfig) (*kolide.AppConfig, error) {
|
|
|
|
d.mtx.Lock()
|
|
|
|
defer d.mtx.Unlock()
|
2016-11-16 13:47:49 +00:00
|
|
|
|
|
|
|
info.ID = 1
|
2016-12-29 18:32:28 +00:00
|
|
|
d.appConfig = info
|
2016-11-16 13:47:49 +00:00
|
|
|
return info, nil
|
|
|
|
}
|
|
|
|
|
2016-12-16 00:12:43 +00:00
|
|
|
func (d *Datastore) AppConfig() (*kolide.AppConfig, error) {
|
|
|
|
d.mtx.Lock()
|
|
|
|
defer d.mtx.Unlock()
|
2016-11-16 13:47:49 +00:00
|
|
|
|
2016-12-29 18:32:28 +00:00
|
|
|
if d.appConfig != nil {
|
|
|
|
return d.appConfig, nil
|
2016-11-16 13:47:49 +00:00
|
|
|
}
|
|
|
|
|
2016-12-20 18:35:22 +00:00
|
|
|
return nil, notFound("AppConfig")
|
2016-11-16 13:47:49 +00:00
|
|
|
}
|
|
|
|
|
2016-12-16 00:12:43 +00:00
|
|
|
func (d *Datastore) SaveAppConfig(info *kolide.AppConfig) error {
|
|
|
|
d.mtx.Lock()
|
|
|
|
defer d.mtx.Unlock()
|
2016-11-16 13:47:49 +00:00
|
|
|
|
2016-12-29 18:32:28 +00:00
|
|
|
d.appConfig = info
|
2016-11-16 13:47:49 +00:00
|
|
|
return nil
|
|
|
|
}
|