- Added settings to workspace, and added the read-only mode - Added the `-ro` field which will launch Dynamo-Browse in read-only mode - Added the `set ro` to enable read-only mode, and `set rw` to enable read-write mode
32 lines
567 B
Go
32 lines
567 B
Go
package settingstore
|
|
|
|
import (
|
|
"github.com/asdine/storm"
|
|
"github.com/lmika/audax/internal/common/workspaces"
|
|
)
|
|
|
|
const settingBucket = "Settings"
|
|
|
|
const (
|
|
keyTableReadOnly = "table_ro"
|
|
)
|
|
|
|
type SettingStore struct {
|
|
ws storm.Node
|
|
}
|
|
|
|
func New(ws *workspaces.Workspace) *SettingStore {
|
|
return &SettingStore{
|
|
ws: ws.DB(),
|
|
}
|
|
}
|
|
|
|
func (c *SettingStore) IsReadOnly() (b bool, err error) {
|
|
err = c.ws.Get(settingBucket, keyTableReadOnly, &b)
|
|
return b, err
|
|
}
|
|
|
|
func (c *SettingStore) SetReadOnly(ro bool) error {
|
|
return c.ws.Set(settingBucket, keyTableReadOnly, ro)
|
|
}
|