1.1.0 • Published 2 months ago

@flowcore/cli-plugin-config v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

Flowcore CLI Plugin - Config

A plugin for the flowcore cli to configure the cli

Version oclif Build and Release

Usage

$ npm install -g @flowcore/cli-plugin-config
$ conf COMMAND
running command...
$ conf (--version)
@flowcore/cli-plugin-config/1.0.5 darwin-arm64 node-v18.18.0
$ conf --help [COMMAND]
USAGE
  $ conf COMMAND
...

this plugin exposes these main components that can be added as a dependency to your plugin:

  • CliConfiguration: a configuration service that can be used to store and retrieve configuration values`
  • createDefaultConfig: a function that creates a default configuration object
  • loadConfig: a function that loads the configuration from the file system
  • getObjectPaths: a function that returns all the paths in an object
  • LOGIN_CODES: an enum that contains the possible login codes
  • UserInfo: a type that represents the user information
  • ValidateLogin: a function that validates the login response
  • BaseCommand: a base class that can be used to access the configuration
  • BaseFlags: a type that can be used to access the base flags
  • BaseArgs: a type that can be used to access the base args

to use this plugin in your plugin, you can add it as a dependency in your package.json file:

$ npm install @flowcore/cli-plugin-config

or if you are using yarn:

$ yarn add @flowcore/cli-plugin-config

and then just extend the BaseCommand class in your command:

import { BaseCommand } from '@flowcore/cli-plugin-config'

export default class MyCommand extends BaseCommand {
  async run() {
    const { flags } = this.parse(MyCommand)
    const config = this.cliConfiguration.getConfig();
    // do something with the config
  }
}

Commands

conf config set

Configure the cli

USAGE
  $ conf config set [--profile <value>] [-b <value>] [-c <value>] [-n <value>] [-l <value>] [-p] [-u <value>]

FLAGS
  -b, --baseUrl=<value>       base url to the flowcore platform
  -c, --clientId=<value>      client id to use for the login
  -l, --loginUrl=<value>      url to discover the openid configuration
  -n, --clientSecret=<value>  name to print
  -p, --port                  prompt for port to listen for the callback
  -u, --url=<value>           url to the flowcore platform api
      --profile=<value>       Specify the configuration profile to use

DESCRIPTION
  Configure the cli

EXAMPLES
  $ conf config set -l https://auth.flowcore.io/realms/flowcore/.well-known/openid-configuration -c my-client-id -s my-client-secret

  $ conf config set -u https://graph.api.flowcore.io/graphql

  $ conf config set -l https://auth.flowcore.io/realms/flowcore/.well-known/openid-configuration -c my-client-id -p

See code: src/commands/config/set.ts

conf config show

Show the configured login url

USAGE
  $ conf config show [--profile <value>]

FLAGS
  --profile=<value>  Specify the configuration profile to use

DESCRIPTION
  Show the configured login url

EXAMPLES
  $ conf config show

See code: src/commands/config/show.ts

conf login

login to the Flowcore Platform

USAGE
  $ conf login [--profile <value>] [-p <value>]

FLAGS
  -p, --port=<value>     [default: 3000] port to listen for the callback
      --profile=<value>  Specify the configuration profile to use

DESCRIPTION
  login to the Flowcore Platform

EXAMPLES
  $ conf login

  $ conf login --port 8080

See code: src/commands/login.ts

conf whoami

Check what user you are logged in as

USAGE
  $ conf whoami [--profile <value>]

FLAGS
  --profile=<value>  Specify the configuration profile to use

DESCRIPTION
  Check what user you are logged in as

See code: src/commands/whoami.ts