2.5.0 • Published 9 months ago
@flowcore/cli-plugin-config v2.5.0
Flowcore CLI Plugin - Config
A plugin for the flowcore cli to configure the cli
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 objectloadConfig: a function that loads the configuration from the file systemgetObjectPaths: a function that returns all the paths in an objectLOGIN_CODES: an enum that contains the possible login codesUserInfo: a type that represents the user informationValidateLogin: a function that validates the login responseBaseCommand: a base class that can be used to access the configurationBaseFlags: a type that can be used to access the base flagsBaseArgs: 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-configor if you are using yarn:
$ yarn add @flowcore/cli-plugin-configand 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 -pSee 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 showSee 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 8080See 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 asSee code: src/commands/whoami.ts