You are browsing documentation for an outdated version. See the latest documentation here.

Dev Portal CLI

The Kong Dev Portal CLI is used to manage your Dev Portals from the command line. It is built using clipanion.

This is the next generation TypeScript based Dev Portal CLI. The goal of this project is to make a higher quality CLI tool over the initial sync script.

Install

  1. > npm install -g kong-portal-cli

Usage

The easiest way to start is by cloning the portal-templates repo master branch locally.

Next, edit workspaces/default/cli.conf.yaml to set the workspace kong_admin_url and kong_admin_token to match your setup.

You can also override the values set in workspaces/default/cli.conf.yaml by using the environment variables KONG_ADMIN_URL and KONG_ADMIN_TOKEN.

Make sure Kong is running and portal is on.

Now, from the root folder of the templates repo, you can run:

portal [-h,--help] [--config PATH] [-v,--verbose] <command> <workspace>

Where <command> is one of:

  • config Output or change configuration of the portal on the given workspace, locally.
  • deploy Deploy changes made locally under the given workspace upstream.
  • disable Disable the portal on the given workspace.
  • enable Enable the portal on the given workspace.
  • fetch Fetches content and themes from the given workspace.
  • wipe Deletes all content and themes from upstream workspace

Where <workspace> indicates the directory/workspace pairing you would like to operate on.

You can set environment variables to override the values in the workspaces/default/cli.conf.yaml file:

  1. KONG_ADMIN_URL=<kong_admin_base_url> \
  2. KONG_ADMIN_TOKEN=<kong_admin_token> \
  3. portal [-h,--help] [--config PATH] [-v,--verbose] <command> <workspace>

Where <kong_admin_base_url> is the location of the Kong Admin API that manages the developer portal and <kong_admin_token> is an RBAC token that has access to manage the portal.

For deploy

  • Add -W or --watch to make changes reactive.
  • Add -P or --preserve to avoid deleting files upstream that you do not have locally.
  • Add -D or --disable-ssl-verification to disable SSL verification and use self-signed certs.
  • Add -I or --ignore-specs to ignore the /specs directory.

For fetch

  • Add -K or --keep-encode to keep binary assets as base64-encoded strings locally.
  • Add -D or --disable-ssl-verification to disable SSL verification and use self-signed certs.
  • Add -I or --ignore-specs to ignore the /specs directory.

For wipe

  • Add -D or --disable-ssl-verification to disable SSL verification and use self-signed certs.
  • Add -I or --ignore-specs to ignore the /specs directory.

For enable and disable

  • Add -D or --disable-ssl-verification to disable SSL verification and use self-signed certs.