CLI configuration

The package @pos-web/devkit-config installs a the CLI utility devkit-config. The devkit-config allows users to set configurations that are retrieved by other Devkit utilities.

CLI usage

The CLI help is,

Copy
$ devkit-config --help

Usage: devkit-config [options] <devkit-package> [operation] [configuration-key] [configuration-value]

Manage configurations for Devkit utilities that is persisted per user

Arguments:
  devkit-package       The package to configure (choices: "devkit-scripts-serve")

  operation            SET or GET a configuration (choices: "get", "set")

  configuration-key    The key to configure.

  configuration-value  The new desired value for that configuration key and package

Options:
  -h, --help           display help for command

The available keys can be retrieved by not adding the operation or configuration-key arguments,

Copy
$ devkit-config devkit-scripts-serve

The available configuration keys for package devkit-scripts-serve are:

certificate - Path where the server certificate is stored. Required to serve HTTPS connections.

key         - Path where the server key is stored. Required to serve HTTPS connections

Once the package and the configuration set is known, to set it we use,

Copy
$ devkit-config PACKAGE_NAME set CONFIGURATION_KEY NEW_VALUE

to retrieve the value,

Copy
$ devkit-config PACKAGE_NAME get CONFIGURATION_KEY

Available configurations

devkit-scripts-serve

The devkit-package devkit-scripts-serve is used to set the certificates required to serve a HTTPS connection using devkit-scripts serve.

The server certificate is set using the configuration key certificate. It will copy the certificate and make it available to the server,

Copy
$ devkit-config devkit-scripts-serve set certificate CERTIFICATE_PATH

The same is required for the server key using the configuration key,

Copy
$ devkit-config devkit-scripts-serve set key KEY_PATH

Internals

The configuration are stored in the folder given by the environment variable DEVKIT_CONFIG_DIR. It defaults to $HOME/.devkit-config.

Each package will have its own folder given by the environment variable. It will contain a file config.json with the stored values as well as any other artifact required by the configuration.