Skip to content

Commit

Permalink
change default file backend
Browse files Browse the repository at this point in the history
  • Loading branch information
jessepeterson committed Jun 18, 2024
1 parent e1981d3 commit d83fa70
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
10 changes: 5 additions & 5 deletions cli/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ func Storage(storageName, dsn string) (storage.AllStorage, error) {
switch storageName {
case "file":
if dsn == "" {
dsn = "db"
dsn = "dbkv"
}
store, err = file.New(dsn)
case "diskv":
store = diskv.New(dsn)
case "file.deprecated":
if dsn == "" {
dsn = "diskv"
dsn = "db"
}
store = diskv.New(dsn)
store, err = file.New(dsn)
case "inmem":
store = inmem.New()
case "mysql":
Expand Down
25 changes: 17 additions & 8 deletions docs/operations-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,30 @@ Specifies the listen address (interface and port number) for the server to liste

The `-storage` and `-storage-dsn` flags together configure the storage backend. `-storage` specifies the name of backend type while `-storage-dsn` specifies the backend data source name (e.g. the connection string). If no `-storage` backend is specified then `file` is used as a default.

##### diskv storage backend
##### file storage backend

* `-storage diskv`
* `-storage file`

Configure the `diskv` storage backend. This backend manages DEP authentication and configuration data within plain filesystem files and directories. It has zero dependencies and should run out of the box. The `-storage-dsn` flag specifies the filesystem directory for the database. If no `storage-dsn` is specified then `diskv` is used as a default.
Configure the `file` storage backend. This backend manages DEP authentication and configuration data within plain filesystem files and directories using a key-value storage system. It has zero dependencies and should run out of the box. The `-storage-dsn` flag specifies the filesystem directory for the database. If no `storage-dsn` is specified then `dbkv` is used as a default.

*Example:* `-storage diskv -storage-dsn /path/to/my/db`
> [!NOTE]
> NanoDEP versions *after* v0.4 have a new key-value based `file` backend. To use the previous version (e.g. to preserve existing data) use the `file.deprecated` backend.
##### file storage backend
*Example:* `-storage file -storage-dsn /path/to/my/db`

* `-storage file`
##### file.deprecated storage backend

Configure the `file` storage backend. This backend manages DEP authentication and configuration data within plain filesystem files and directories. It has zero dependencies and should run out of the box. The `-storage-dsn` flag specifies the filesystem directory for the database. If no `storage-dsn` is specified then `db` is used as a default.
* `-storage file.deprecated`

*Example:* `-storage file -storage-dsn /path/to/my/db`
> [!WARNING]
> The `file.deprecated` (formerly the default `file` backend) will be removed from a future NanoDEP release.
Configure the `file.deprecated` storage backend. This backend manages DEP authentication and configuration data within plain filesystem files and directories. It has zero dependencies and should run out of the box. The `-storage-dsn` flag specifies the filesystem directory for the database. If no `storage-dsn` is specified then `db` is used as a default.

> [!NOTE]
> This was previously the default `file` storage backend in NanoDEP v0.4 and below.
*Example:* `-storage file.deprecated -storage-dsn /path/to/my/db`

##### in-memory storage backend

Expand Down

0 comments on commit d83fa70

Please sign in to comment.