diff --git a/README.md b/README.md index ff6a65b..f59172a 100644 --- a/README.md +++ b/README.md @@ -13,28 +13,59 @@ Run `asconfig --help` and see the sections below for more details. # Usage -asconfig [command] +`asconfig COMMAND [flags] [arguments]` -## Supported commands +## Supported Commands -| Name | Description | -| ---- | ----------- | -| convert | convert yaml to aerospike config format | +| Command | Description | +| ------- | ----------- | +| completion [flags] | Generate the autocompletion script for the specified shell | +| convert [flags] | Convert yaml to aerospike config format | +| help [command] | Help about any command | ## Usage examples Convert local file "aerospike.yaml" to aerospike config format for Aerospike server version 6.2.0 and write it to local file "aerospike.conf." + ```shell asconfig convert --aerospike-version "6.2.0" aerospike.yaml --output aerospike.conf ``` + Short form flags and source file only conversions are also supported. In this case, -a is the server version and using only a source file means the result will be written to stdout. + ```shell asconfig convert -a "6.2.0" aerospike.yaml ``` +## Schema validation + +Installing the [Red Hat YAML vscode extension](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml) is recommended. The extension allows using the Aerospike configuration json schema files for code suggestions in vscode when creating your own yaml configuration. + +The json schema files used by asconfig and in this example are stored in the [asconfig schema directory](https://github.com/aerospike/asconfig/tree/main/schema/json). In order to use them for writing your own yaml config, clone the [asconfig github repository](https://github.com/aerospike/asconfig) and follow the example below. + +### Example + +You can load schema files into most IDE's to get code suggestions. The following steps walk through this process in vscode. + +- Install the [Red Hat YAML vscode extension](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml). + +- In vscode, go to preferences, then settings. Search for "YAML schema" and click "edit in settings.json". + +- Add a yaml.schemas mapping like the one below to your settings.json. Replace "/absolute/path/to/asconfig/repo" with the path to your local clone of the asconfig repo. + + ```json + "yaml.schemas": { + "/absolute/path/to/asconfig/repo/schema/json/6.2.0.json": ["/*aerospike.yaml"] + } + ``` + + This will associate all files ending in "aerospike.yaml" with the 6.2.0 Aerospike yaml schema. + +Now you can use the code suggestions from the 6.2.0 Aerospike yaml schema to write your yaml configuration. + ## Configuration Examples Here is an example yaml config and the command to convert it to an [Aerospike configuration file](https://docs.aerospike.com/server/operations/configure) for database version 6.2.0.x. @@ -92,14 +123,18 @@ For More examples see the aerospikeConfig property from the [Aerospike Kubernete ## Build Build asconfig using the included top level makefile. + ```shell make ``` + The resulting binary is available at bin/asconfig Building rpm, deb, and tar packages is also done using the makefile. You will have to install fpm and rpmbuild to build all of these. -``` + +```shell make rpm deb tar ``` + The packages will be available in the pkg/ directory.