@flowcore/cli-plugin-config
Version:
Flowcore CLI configuration plugin
166 lines (121 loc) • 4.79 kB
Markdown
Flowcore CLI Plugin - Config
=================
A plugin for the flowcore cli to configure the cli
[](https://npmjs.org/package/@flowcore/cli-plugin-config)
[](https://oclif.io)
[](https://github.com/@flowcore/cli-plugin-config/actions/workflows/build.yml)
<!-- toc -->
* [Usage](#usage)
* [Commands](#commands)
<!-- tocstop -->
# Usage
<!-- usage -->
```sh-session
$ npm install -g @flowcore/cli-plugin-config
$ conf COMMAND
running command...
$ conf (--version)
@flowcore/cli-plugin-config/2.5.0 linux-x64 node-v22.13.1
$ conf --help [COMMAND]
USAGE
$ conf COMMAND
...
```
<!-- usagestop -->
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:
```sh-session
$ npm install @flowcore/cli-plugin-config
```
or if you are using yarn:
```sh-session
$ yarn add @flowcore/cli-plugin-config
```
and then just extend the `BaseCommand` class in your command:
```typescript
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
<!-- commands -->
* [`conf config set`](#conf-config-set)
* [`conf config show`](#conf-config-show)
* [`conf login`](#conf-login)
* [`conf whoami`](#conf-whoami)
## `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](https://github.com/flowcore/flowcore-cli-plugin-config/blob/v2.5.0/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](https://github.com/flowcore/flowcore-cli-plugin-config/blob/v2.5.0/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](https://github.com/flowcore/flowcore-cli-plugin-config/blob/v2.5.0/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](https://github.com/flowcore/flowcore-cli-plugin-config/blob/v2.5.0/src/commands/whoami.ts)_
<!-- commandsstop -->