all repos — litestore @ 9bc3a91213e4cd1b900eb925e8ef691b4f64cf43

A minimalist nosql document store.

Workflow fixes, changed --import-tags option, other doc fixss.
h3rald h3rald@h3rald.com
Wed, 14 Apr 2021 18:58:06 +0200
commit

9bc3a91213e4cd1b900eb925e8ef691b4f64cf43

parent

c2c1a09d07363e3229ed6b36d0fd44ea11320a18

M .github/workflows/add-artifacts-to-current-release.yml.github/workflows/add-artifacts-to-current-release.yml

@@ -47,7 +47,6 @@ shell: bash

run: | echo "$HOME/.nimble/bin" >> $GITHUB_PATH echo $GITHUB_WORKSPACE >> $GITHUB_PATH - #if: matrix.os == 'macos-latest' || matrix.os == 'ubuntu-latest' # Sets path (Windows) - name: Update %PATH%

@@ -71,17 +70,10 @@ unzip hastyscribe.zip

mv src/hastyscribe . if: matrix.os == 'macos-latest' || matrix.os == 'ubuntu-latest' - # Install HastyScribe (Windows) - #- name: Install HastyScribe (Windows) - # run: | - # curl https://github.com/h3rald/hastyscribe/releases/download/v1.12.3/hastyscribe_v1.12.3_${{steps.os.outputs.id}}_x64.zip -L -o hastyscribe.zip - # Expand-Archive -Path hastyscribe.zip -DestinationPath . - # if: matrix.os == 'windows-latest' - + # Temporary Windows-specific fix (missing certificates for nimble) - name: Install cert (temporary fix, windows only) run: | curl https://curl.se/ca/cacert.pem -L -o cacert.pem - #move cacert.pem "${HOME}\.nimble\bin\cacert.pem" if: matrix.os == 'windows-latest' # Build for Linux
M build_guidebuild_guide

@@ -30,7 +30,7 @@ for page in ${pages[@]}

do (cat "${page}"; printf "\n\n") >> LiteStore_UserGuide.md done -hastyscribe --field/version:1.9.3 LiteStore_UserGuide.md +hastyscribe --field/version:1.10.0 LiteStore_UserGuide.md rm LiteStore_UserGuide.md -mv LiteStore_UserGuide.htm .. +mv LiteStore_UserGuide.htm ../.. cd ../..
M src/admin/md/api_docs.mdsrc/admin/md/api_docs.md

@@ -88,7 +88,7 @@

##### Example ``` -$ curl -i -X POST -d 'A document with a randomly-generated ID.' 'http://127.0.0.1:9500/docs' --header "Content-Type:text/plain" +$ curl -i -X POST -d 'A document with a randomly-generated ID.' 'http://127.0.0.1:9500/docs' -\-header "Content-Type:text/plain" HTTP/1.1 201 Created Content-Length: 197 Content-Type: application/json
M src/admin/md/auth.mdsrc/admin/md/auth.md

@@ -40,8 +40,8 @@ However, users with the **admin:wiki** scope will be able to access documents located under the /docs/wiki/ folder.

Finally, specify the public signature to be used to validate JWT tokens using the **signature** property. Typically, its value should be set to the first value of the [x.509 certificate chain](https://auth0.com/docs/tokens/reference/jwt/jwks-properties) specified in the [JSON Web Key Set](https://auth0.com/docs/jwks) of your API. -To use this configuration at runtime, specify it through the **--auth** option, like this: +To use this configuration at runtime, specify it through the **-\-auth** option, like this: -`litestore --auth:auth.json` +`litestore -\-auth:auth.json` Once enabled, LiteStore will return HTTP 401 error codes if an invalid token or no token is included in the HTTP Authorization header of the request accessing the resource or HTTP 403 error codes in case an authenticated user does not have a valid scope to access a specified resource.
M src/admin/md/configuration-file.mdsrc/admin/md/configuration-file.md

@@ -1,6 +1,6 @@

## Configuration File -As of version 1.8.0, you can specify a configuration file containing settings, middleware and authorization configuration using the **--config** or **-c** command line option: +As of version 1.8.0, you can specify a configuration file containing settings, middleware and authorization configuration using the **-\-config** or **-c** command line option: [litestore -c:config.json](class:cmd)
M src/admin/md/getting-started.mdsrc/admin/md/getting-started.md

@@ -9,17 +9,17 @@ * [LiteStore for Mac OS X (x64)](https://github.com/h3rald/litestore/releases/download/{{$version}}/litestore_{{$version}}_macosx_x64.zip)

* [LiteStore for Windows (x64)](https://github.com/h3rald/litestore/releases/download/{{$version}}/litestore_{{$version}}_windows_x64.zip) * [LiteStore for Linux (x64)](https://github.com/h3rald/litestore/releases/download/{{$version}}/litestore_{{$version}}_linux_x64.zip) -### Running a Docker image +### Running a Docker Image as a Container Official Docker images are available [on Docker Hub](https://hub.docker.com/repository/docker/h3rald/litestore). Just pull the latest version: -[docker pull h3rald/litestore:{{$version}}](class:cmd) +[docker pull h3rald/litestore:v{{$version}}](class:cmd) then start a container to run the image on port 9500: -[docker run -p 9500:9500 martin/litestore:{{$version}} -a:0.0.0.0](class:cmd) +[docker run -p 9500:9500 h3rald/litestore:v{{$version}} -a:0.0.0.0](class:cmd) > %tip% > Tip
M src/admin/md/system-documents.mdsrc/admin/md/system-documents.md

@@ -14,7 +14,7 @@ * **middleware/\*.js** — Any [.js](class:ext) file containing the definition of a middleware function, placed within a [middleware](class:dir) folder.

### Importing, exporting and deleting System Documents -You can import, export, and delete system documents with the respective commands, but you must specify the [--system](class:kwd) command line flag. +You can import, export, and delete system documents with the respective commands, but you must specify the [-\-system](class:kwd) command line flag. For example, suppose you have a [sysdocs](class:dir) folder containing the following file hierarchy:

@@ -28,13 +28,13 @@ * validate.js

To import all the documents stored within the [sysdocs](class:dir) folder, you must run the following command: -[litestore -d:sysdocs --system import](class:kwd) +[litestore -d:sysdocs -\-system import](class:kwd) -Similarly, the [export](class:kwd) and [delete](class:kwd) commands can be used to export and delete system documents respectively, always specifying the [--system](class:kwd) flag. +Similarly, the [export](class:kwd) and [delete](class:kwd) commands can be used to export and delete system documents respectively, always specifying the [-\-system](class:kwd) flag. ### How LiteStore uses System Documents -While at development time you may want to be able to edit your system documents and therefore keep them outside your data store as ordinary text files (and load them using the **--auth**, **--config** and **--middleware** options), in production you may want to ship them within the data store along with your application data. +While at development time you may want to be able to edit your system documents and therefore keep them outside your data store as ordinary text files (and load them using the **-\-auth**, **-\-config** and **-\s-middleware** options), in production you may want to ship them within the data store along with your application data. At run time, LiteStore will attempt to retrieve settings/middleware/authorization configuration using the following order of precedence (first listed have higher precedence):
M src/admin/md/usage.mdsrc/admin/md/usage.md

@@ -17,24 +17,24 @@

#### Options * **-a**, **-\-address** — Specify server address (default: 127.0.0.1). -* **--auth** — Specify an authorization configuration file. -* **-b**, **--body** — Specify a string containing input data for an operation to be executed. -* **-c**, **--config** — Specify a configuration file. +* **-\-auth** — Specify an authorization configuration file. +* **-b**, **-\-body** — Specify a string containing input data for an operation to be executed. +* **-c**, **-\-config** — Specify a configuration file. * **-d**, **-\-directory** — Specify a directory to serve, import, export, delete, or mount. -* **-f**, **--file** — Specify a file containing input data for an operation to be executed. +* **-f**, **-\-file** — Specify a file containing input data for an operation to be executed. * **-h**, **-\-help** — Display program usage. * **-l**, **-\-log** — Specify the log level: debug, info, warn, error, none (default: info) * **-m**, **-\-mount** — Mirror database changes to the specified directory on the filesystem. -* **-o**, **--operation** — Specify an operation to execute via the execute command: get, put, delete, patch, post, head, options. +* **-o**, **-\-operation** — Specify an operation to execute via the execute command: get, put, delete, patch, post, head, options. * **-p**, **-\-port** —Specify server port number (default: 9500). * **-r**, **-\-readonly** — Allow only data retrieval operations. * **-s**, **-\-store** — Specify a datastore file (default: data.db) -* **--system** — Set the system flag for import, export, and delete operations -* **--importTags** — During import read tags from '_tags' file and apply them to imported documents from the same directory. -* **-t**, **--type** — Specify a content type for the body an operation to be executed via the execute command. -* **-u**, **--uri** — Specify an uri to execute an operation through the execute command. +* **-\-system** — Set the system flag for import, export, and delete operations +* **-\-import-tags** — During import read tags from '_tags' file and apply them to imported documents from the same directory. +* **-t**, **-\-type** — Specify a content type for the body an operation to be executed via the execute command. +* **-u**, **-\-uri** — Specify an uri to execute an operation through the execute command. * **-v**, **-\-version** — Display the program version. -* **-w**, **--middleware** — Specify a path to a folder containing middleware definitions +* **-w**, **-\-middleware** — Specify a path to a folder containing middleware definitions ### Examples

@@ -78,14 +78,15 @@ #### Importing system documents from a directory

Import all documents stored in a directory called **system** as system documents: -[litestore import -d:system --system](class:cmd) +[litestore import -d:system -\-system](class:cmd) Import all documents stored in a directory called **media** (including subdirectories): + ``` + media + cars | + _tags - | + Lamborgini.jpg + | + Lamborghini.jpg | + VW.jpg | ` BMW.jpg + planes

@@ -98,11 +99,11 @@ + TGV.jpg

` Eurostar.jpg ``` -[litestore import -d:media --importTags](class:cmd) +[litestore import -d:media -\-import-tags](class:cmd) Every **_tags** file contains a list of tags, one per line, which are applied to all imported documents from the same directory. In the example above all cars and planes images will be tagged on import. The trains images, not as there is not **_tags** file in the **trains** directory. -The individual **_tags** files are also imported. When the **--importTags** option is not set the **_tags** files are ignored and not imported. +The individual **_tags** files are also imported. When the **\-\-import\-tags** option is not set the **_tags** files are ignored and not imported. #### Exporting a directory
M src/litestorepkg/lib/cli.nimsrc/litestorepkg/lib/cli.nim

@@ -160,9 +160,9 @@ configFile = val

of "mount", "m": mount = true cliSettings["mount"] = %mount - of "importTags": + of "import-tags": importTags = true - cliSettings["importTags"] = %importTags + cliSettings["import-tags"] = %importTags of "version", "v": echo pkgVersion quit(0)
M src/litestorepkg/lib/core.nimsrc/litestorepkg/lib/core.nim

@@ -776,7 +776,7 @@ if LS.execution.operation == "" and LS.operation == opExecute:

fail(111, "--operation option not specified") if LS.importTags and LS.operation != opImport: - fail(116, "--importTags option alowed only for import operation.") + fail(116, "--import-tags option alowed only for import operation.") proc updateConfig*(LS: LiteStore) = let rawConfig = LS.config.pretty if LS.configFile != "":