|
4 | 4 |
|
5 | 5 | The GO Feature Flag Command Line is a CLI tool to interact with GO Feature Flag in your terminal. |
6 | 6 | For now it supports the following commands: |
| 7 | + |
7 | 8 | - `evaluate` to evaluate feature flags directly in your terminal |
8 | 9 | - `lint` to validate a configuration file format. |
9 | 10 |
|
10 | 11 | ## How to install the cli |
11 | 12 |
|
12 | 13 | ### Install using Homebrew (mac and linux) |
| 14 | + |
13 | 15 | ```shell |
14 | 16 | brew tap thomaspoignant/homebrew-tap |
15 | 17 | brew install go-feature-flag-cli |
16 | 18 | ``` |
17 | 19 |
|
18 | 20 | ### Install using docker |
| 21 | + |
19 | 22 | ```shell |
20 | 23 | docker pull gofeatureflag/go-feature-flag-cli |
21 | 24 | ``` |
22 | | -More information about the usage of the container in the [dockerhub page](https://hub.docker.com/r/gofeatureflag/go-feature-flag-cli). |
| 25 | + |
| 26 | +More information about the usage of the container in |
| 27 | +the [dockerhub page](https://hub.docker.com/r/gofeatureflag/go-feature-flag-cli). |
23 | 28 |
|
24 | 29 | # How to use the command line |
25 | 30 |
|
26 | 31 | **`go-feature-flag-cli`** is a command line tool. |
27 | 32 |
|
28 | 33 | ## How to evaluate a flag |
| 34 | + |
| 35 | +The evaluate command allows you to evaluate a feature flag or inspect the configuration of your retriever using |
| 36 | +`--check-mode` |
| 37 | + |
| 38 | +```shell |
| 39 | +go-feature-flag-cli evaluate [OPTIONS] |
| 40 | +``` |
| 41 | + |
| 42 | +### Key Flags |
| 43 | + |
| 44 | +| Flag | Shorthand | Description | Default | |
| 45 | +|----------------|-----------|---------------------------------------------------------------------------------------------------------------------------------|---------| |
| 46 | +| `--kind` | k | Kind of configuration source. Determines where to read your flags from | file | |
| 47 | +| `--config` | c | Path to the local flag configuration file (⚠️ deprecated, use `--path` instead) | "" | |
| 48 | +| `--format` | f | Format of your input file (YAML, JSON or TOML) | yaml | |
| 49 | +| `--flag` | | Name of the flag to evaluate | "" | |
| 50 | +| `--timeout` | | Timeout in seconds to access your configuration file | 0 | |
| 51 | +| `--ctx` | | Evaluation context as a json string | {} | |
| 52 | +| `--check-mode` | | Check only mode - when set, the command will not perform any <br/>evaluation and returns the configuration of spanned retriever | false | |
| 53 | + |
| 54 | +Supported values for `--kind` are: |
| 55 | + |
| 56 | +- `file` |
| 57 | +- `http` |
| 58 | +- `github` |
| 59 | +- `gitlab` |
| 60 | +- `s3` |
| 61 | +- `googleStorage` |
| 62 | +- `configmap` (kubernetes) |
| 63 | +- `mongodb` |
| 64 | +- `bitbucket` |
| 65 | +- `azureBlobStorage` |
| 66 | +- `postgresql` |
| 67 | + |
| 68 | +**Caution**: We do not support `redis` retriever as for now due |
| 69 | +to: https://github.com/thomaspoignant/go-feature-flag/issues/4023. |
| 70 | + |
| 71 | +### Retriever specific flags |
| 72 | + |
| 73 | +The aforementioned `--kind` parameter is used to determine the retriever to use. The semantic meaning of other flags |
| 74 | +depends on that one, for |
| 75 | +example `--path` parameter is used to specify local file when `--kind` being `file` but when `--kind` being `github` it |
| 76 | +is used to specify |
| 77 | +the path to the remote file. |
| 78 | + |
| 79 | +#### File |
| 80 | + |
| 81 | +| Flag | Description | Default | |
| 82 | +|----------|-------------------------------------------|---------| |
| 83 | +| `--path` | Path to the local flag configuration file | "" | |
| 84 | + |
| 85 | +#### HTTP |
| 86 | + |
| 87 | +| Flag | Description | Default | |
| 88 | +|------------|---------------------------------------------------------------------|---------| |
| 89 | +| `--url` | URL of the remote flag configuration file | "" | |
| 90 | +| `--method` | HTTP method to access your configuration file on HTTP | GET | |
| 91 | +| `--body` | Http body to access your configuration file on HTTP | "" | |
| 92 | +| `--header` | Header to add to the request. Supported formats are `k:v` and `k=v` | "" | |
| 93 | + |
| 94 | +#### GitHub |
| 95 | + |
| 96 | +| Flag | Description | Default | |
| 97 | +|---------------------|-------------------------------------------------------------------------------------------------------------------|---------| |
| 98 | +| `--repository-slug` | Name of the repository | "" | |
| 99 | +| `--branch` | Git branch name | "" | |
| 100 | +| `--auth-token` | Authentication token to access your configuration file | "" | |
| 101 | +| `--github-token` | Authentication token to access your configuration file on GitHub<br/> (⚠️ deprecated, use `--auth-token` instead) | "" | |
| 102 | +| `--path` | Path to the remote flag configuration file inside github repository | "" | |
| 103 | + |
| 104 | +#### GitLab |
| 105 | + |
| 106 | +| Flag | Description | Default | |
| 107 | +|---------------------|---------------------------------------------------------------------|---------| |
| 108 | +| `--base-url` | Base URL of your configuration file on Gitlab | "" | |
| 109 | +| `--repository-slug` | Name of the repository | "" | |
| 110 | +| `--branch` | Git branch name | "" | |
| 111 | +| `--path` | Path to the remote flag configuration file inside gitlab repository | "" | |
| 112 | + |
| 113 | +#### BitBucket |
| 114 | + |
| 115 | +| Flag | Description | Default | |
| 116 | +|---------------------|------------------------------------------------------------------------|---------| |
| 117 | +| `--base-url` | Base URL of your configuration file on BitBucket | "" | |
| 118 | +| `--repository-slug` | Name of the repository | "" | |
| 119 | +| `--branch` | Git branch name | "" | |
| 120 | +| `--path` | Path to the remote flag configuration file inside bitbucket repository | "" | |
| 121 | + |
| 122 | +#### S3 |
| 123 | + |
| 124 | +| Flag | Description | Default | |
| 125 | +|------------|--------------------|---------| |
| 126 | +| `--bucket` | Name of the bucket | "" | |
| 127 | +| `--item` | Item of the bucket | "" | |
| 128 | + |
| 129 | +#### Google Storage |
| 130 | + |
| 131 | +| Flag | Description | Default | |
| 132 | +|------------|----------------------|---------| |
| 133 | +| `--bucket` | Name of the bucket | "" | |
| 134 | +| `--object` | Object of the bucket | "" | |
| 135 | + |
| 136 | +#### ConfigMap (Kubernetes) |
| 137 | + |
| 138 | +| Flag | Description | Default | |
| 139 | +|----------------|----------------------------|-----------| |
| 140 | +| `--namespace` | Namespace of the ConfigMap | "default" | |
| 141 | +| `--config-map` | Name of the ConfigMap | "" | |
| 142 | +| `--key` | Key of the ConfigMap | "" | |
| 143 | + |
| 144 | +#### MongoDB |
| 145 | + |
| 146 | +| Flag | Description | Default | |
| 147 | +|----------------|-----------------------------------------------------|---------| |
| 148 | +| `--uri` | URI of your configuration file | "" | |
| 149 | +| `--database` | Database name of your configuration file on mongodb | "" | |
| 150 | +| `--collection` | Collection of your configuration file on mongodb | "" | |
| 151 | + |
| 152 | +#### Azure Blob Storage |
| 153 | + |
| 154 | +| Flag | Description | Default | |
| 155 | +|------------------|-----------------------------|---------| |
| 156 | +| `--account-name` | Name of the storage account | "" | |
| 157 | +| `--account-key` | Key of the storage account | "" | |
| 158 | +| `--container` | Name of the container | "" | |
| 159 | +| `--object` | Name of the object blob | "" | |
| 160 | + |
| 161 | +#### PostgreSQL |
| 162 | + |
| 163 | +| Flag | Description | Default | |
| 164 | +|------------|----------------------------------------------------|---------| |
| 165 | +| `--uri` | URI of your configuration file | "" | |
| 166 | +| `--table` | Table of your configuration file | "" | |
| 167 | +| `--column` | Column mapping to add. Supported format is `c1:c2` | "" | |
| 168 | + |
| 169 | +As mentioned above the `--config` flag is deprecated and we encourage you to use the `--path` flag instead. For example |
| 170 | +the following command: |
| 171 | + |
29 | 172 | ```shell |
30 | 173 | go-feature-flag-cli evaluate --config="<location_of_your_flag_configuration_file>" --flag="<name_of_your_flag_to_evaluate>" --ctx='<evaluation_ctx_as_json_string>' |
31 | 174 | ``` |
32 | 175 |
|
| 176 | +may be replaced by: |
| 177 | + |
| 178 | +```shell |
| 179 | +go-feature-flag-cli evaluate --kind="file" --path="<location_of_your_flag_configuration_file>" --flag="<name_of_your_flag_to_evaluate>" --ctx='<evaluation_ctx_as_json_string>' |
| 180 | +``` |
| 181 | + |
33 | 182 | ## How to lint a configuration file |
| 183 | + |
34 | 184 | ```shell |
35 | 185 | go-feature-flag-cli lint <location_of_your_flag_configuration_file> --format="<yaml or json or toml>" |
36 | 186 | ``` |
37 | 187 |
|
38 | 188 | # License |
39 | 189 |
|
40 | | -View [license](https://github.com/thomaspoignant/go-feature-flag/blob/main/LICENSE) information for the software contained in this image. |
| 190 | +View [license](https://github.com/thomaspoignant/go-feature-flag/blob/main/LICENSE) information for the software |
| 191 | +contained in this image. |
41 | 192 |
|
42 | 193 | ## How can I contribute? |
43 | | -This project is open for contribution, see the [contributor's guide](https://github.com/thomaspoignant/go-feature-flag/blob/main/CONTRIBUTING.md) for some helpful tips. |
| 194 | + |
| 195 | +This project is open for contribution, see |
| 196 | +the [contributor's guide](https://github.com/thomaspoignant/go-feature-flag/blob/main/CONTRIBUTING.md) for some helpful |
| 197 | +tips. |
0 commit comments