-
-
Couldn't load subscription status.
- Fork 178
feat: add support for all retrievers in cli #4025
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
DeamonDev
wants to merge
42
commits into
thomaspoignant:main
Choose a base branch
from
DeamonDev:feature-add-support-for-all-retrievers-in-cli
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,501
−115
Open
Changes from 21 commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
2f2665d
add support for github retriever
DeamonDev 812c65d
refactor evaluate struct
DeamonDev 9bb98da
add gitlab retriever support
DeamonDev a89ab25
fix formatting
DeamonDev 09d5f1e
add support for bitbucket retriever
DeamonDev 448aa69
add support for s3 retriever
DeamonDev 1c05e87
start adding support for http retriever
DeamonDev 8d62a36
add test for http retriever
DeamonDev 1163fa1
add check flag
DeamonDev 15052c2
add test for evaluate cmd http retriever
DeamonDev 86ffc80
add more tests
DeamonDev f551f0d
add more tests for s3 and bitbucket
DeamonDev 6e54164
add support for gcs
DeamonDev 2d97760
little refactor
DeamonDev fc3678b
add support for mongodb
DeamonDev fadeb12
add support for azure and postgres
DeamonDev 8230bce
start writing docs
DeamonDev d09c14f
add readme
DeamonDev 58acc14
add timeout in docs
DeamonDev e0fb0ca
link redis options issue
DeamonDev fcf358d
add todo comment
DeamonDev c462a7e
Merge branch 'main' into feature-add-support-for-all-retrievers-in-cli
thomaspoignant 8e94cb1
little refactor
DeamonDev 76f0a13
trailing space
DeamonDev 51a412b
make lint happy
DeamonDev 19032d8
Merge branch 'main' into feature-add-support-for-all-retrievers-in-cli
DeamonDev 37303f9
correct readme for cli
DeamonDev eb47d9a
correct initialization of retrievers
DeamonDev a2e0d93
correct tests after adding init calls
DeamonDev 451998d
Merge branch 'main' into feature-add-support-for-all-retrievers-in-cli
DeamonDev e92a641
Merge branch 'main' into feature-add-support-for-all-retrievers-in-cli
DeamonDev 9b34545
Merge branch 'main' into feature-add-support-for-all-retrievers-in-cli
DeamonDev b88bdbe
Merge branch 'main' into feature-add-support-for-all-retrievers-in-cli
DeamonDev f650bcc
Merge branch 'main' into feature-add-support-for-all-retrievers-in-cli
DeamonDev 79ae1ef
Merge branch 'main' into feature-add-support-for-all-retrievers-in-cli
DeamonDev 00d9906
remove json tags
DeamonDev c90bb05
Merge branch 'main' into feature-add-support-for-all-retrievers-in-cli
DeamonDev 044e22c
nolint
DeamonDev f8fffc7
Merge branch 'main' into feature-add-support-for-all-retrievers-in-cli
DeamonDev 9198f99
Merge branch 'main' into feature-add-support-for-all-retrievers-in-cli
DeamonDev 3afddcd
Merge branch 'main' into feature-add-support-for-all-retrievers-in-cli
DeamonDev 48977f8
Merge branch 'main' into feature-add-support-for-all-retrievers-in-cli
DeamonDev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,40 +4,193 @@ | |
|
|
||
| The GO Feature Flag Command Line is a CLI tool to interact with GO Feature Flag in your terminal. | ||
| For now it supports the following commands: | ||
|
|
||
| - `evaluate` to evaluate feature flags directly in your terminal | ||
| - `lint` to validate a configuration file format. | ||
|
|
||
| ## How to install the cli | ||
|
|
||
| ### Install using Homebrew (mac and linux) | ||
|
|
||
| ```shell | ||
| brew tap thomaspoignant/homebrew-tap | ||
| brew install go-feature-flag-cli | ||
| ``` | ||
|
|
||
| ### Install using docker | ||
|
|
||
| ```shell | ||
| docker pull gofeatureflag/go-feature-flag-cli | ||
| ``` | ||
| More information about the usage of the container in the [dockerhub page](https://hub.docker.com/r/gofeatureflag/go-feature-flag-cli). | ||
|
|
||
| More information about the usage of the container in | ||
| the [dockerhub page](https://hub.docker.com/r/gofeatureflag/go-feature-flag-cli). | ||
|
|
||
| # How to use the command line | ||
|
|
||
| **`go-feature-flag-cli`** is a command line tool. | ||
|
|
||
| ## How to evaluate a flag | ||
|
|
||
| The evaluate command allows you to evaluate a feature flag or inspect the configuration of your retriever using | ||
| `--check-mode` | ||
|
|
||
| ```shell | ||
| go-feature-flag-cli evaluate [OPTIONS] | ||
| ``` | ||
|
|
||
| ### Key Flags | ||
|
|
||
| | Flag | Shorthand | Description | Default | | ||
| |----------------|-----------|---------------------------------------------------------------------------------------------------------------------------------|---------| | ||
| | `--kind` | k | Kind of configuration source. Determines where to read your flags from | file | | ||
| | `--config` | c | Path to the local flag configuration file (⚠️ deprecated, use `--path` instead) | "" | | ||
| | `--format` | f | Format of your input file (YAML, JSON or TOML) | yaml | | ||
| | `--flag` | | Name of the flag to evaluate | "" | | ||
| | `--timeout` | | Timeout in seconds to access your configuration file | 0 | | ||
| | `--ctx` | | Evaluation context as a json string | {} | | ||
| | `--check-mode` | | Check only mode - when set, the command will not perform any <br/>evaluation and returns the configuration of spanned retriever | false | | ||
|
|
||
| Supported values for `--kind` are: | ||
|
|
||
| - `file` | ||
| - `http` | ||
| - `github` | ||
| - `gitlab` | ||
| - `s3` | ||
| - `googleStorage` | ||
| - `configmap` (kubernetes) | ||
| - `mongodb` | ||
| - `bitbucket` | ||
| - `azureBlobStorage` | ||
| - `postgresql` | ||
|
|
||
| **Caution**: We do not support `redis` retriever as for now due to: https://github.com/thomaspoignant/go-feature-flag/issues/4023. | ||
|
|
||
| ### Retriever specific flags | ||
|
|
||
| The aforementioned `--kind` parameter is used to determine the retriever to use. The semantic meaning of other flags | ||
| depends on that one, for | ||
| example `--path` parameter is used to specify local file when `--kind` being `file` but when `--kind` being `github` it | ||
| is used to specify | ||
| the path to the remote file. | ||
|
|
||
| #### File | ||
|
|
||
| | Flag | Description | Default | | ||
| |----------|-------------------------------------------|---------| | ||
| | `--path` | Path to the local flag configuration file | "" | | ||
|
|
||
| #### HTTP | ||
|
|
||
| | Flag | Description | Default | | ||
| |------------|---------------------------------------------------------------------|---------| | ||
| | `--url` | URL of the remote flag configuration file | "" | | ||
| | `--method` | HTTP method to access your configuration file on HTTP | "" | | ||
| | `--body` | Http body to access your configuration file on HTTP | GET | | ||
DeamonDev marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| | `--header` | Header to add to the request. Supported formats are `k:v` and `k=v` | "" | | ||
|
|
||
| #### GitHub | ||
|
|
||
| | Flag | Description | Default | | ||
| |---------------------|-------------------------------------------------------------------------------------------------------------------|---------| | ||
| | `--repository-slug` | | "" | | ||
| | `--branch` | Name of the repository | "" | | ||
| | `--auth-token` | Authentication token to access your configuration file | "" | | ||
| | `--github-token` | Authentication token to access your configuration file on GitHub<br/> (⚠️ deprecated, use `--auth-token` instead) | "" | | ||
| | `--path` | Path to the remote flag configuration file inside github repository | "" | | ||
|
|
||
| #### GitLab | ||
|
|
||
| | Flag | Description | Default | | ||
| |---------------------|---------------------------------------------------------------------|---------| | ||
| | `--base-url` | Base URL of your configuration file on Gitlab | "" | | ||
| | `--repository-slug` | Name of the repository | "" | | ||
| | `--branch` | Name of the repository | "" | | ||
| | `--path` | Path to the remote flag configuration file inside gitlab repository | "" | | ||
|
|
||
| #### BitBucket | ||
|
|
||
| | Flag | Description | Default | | ||
| |---------------------|------------------------------------------------------------------------|---------| | ||
| | `--base-url` | Base URL of your configuration file on BitBucket | "" | | ||
| | `--repository-slug` | Name of the repository | "" | | ||
| | `--branch` | Name of the repository | "" | | ||
| | `--path` | Path to the remote flag configuration file inside bitbucket repository | "" | | ||
DeamonDev marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| #### S3 | ||
|
|
||
| | Flag | Description | Default | | ||
| |------------|--------------------|---------| | ||
| | `--bucket` | Name of the bucket | "" | | ||
| | `--item` | Item of the bucket | "" | | ||
|
|
||
| #### Google Storage | ||
|
|
||
| | Flag | Description | Default | | ||
| |------------|----------------------|---------| | ||
| | `--bucket` | Name of the bucket | "" | | ||
| | `--object` | Object of the bucket | "" | | ||
|
|
||
| #### ConfigMap (Kubernetes) | ||
|
|
||
| | Flag | Description | Default | | ||
| |----------------|----------------------------|-----------| | ||
| | `--namespace` | Namespace of the ConfigMap | "default" | | ||
| | `--config-map` | Name of the ConfigMap | "" | | ||
| | `--key` | Key of the ConfigMap | "" | | ||
|
|
||
| #### MongoDB | ||
|
|
||
| | Flag | Description | Default | | ||
| |----------------|-----------------------------------------------------|---------| | ||
| | `--uri` | URI of your configuration file | "" | | ||
| | `--database` | Database name of your configuration file on mongodb | "" | | ||
| | `--collection` | Collection of your configuration file on mongodb | "" | | ||
|
|
||
| #### Azure Blob Storage | ||
|
|
||
| | Flag | Description | Default | | ||
| |------------------|-----------------------------|---------| | ||
| | `--account-name` | Name of the storage account | "" | | ||
| | `--account-key` | Key of the storage account | "" | | ||
| | `--container` | Name of the container | "" | | ||
| | `--object` | Name of the object blob | "" | | ||
|
|
||
| #### PostgreSQL | ||
|
|
||
| | Flag | Description | Default | | ||
| |------------|----------------------------------------------------|---------| | ||
| | `--uri` | URI of your configuration file | "" | | ||
| | `--table` | Table of your configuration file | "" | | ||
| | `--column` | Column mapping to add. Supported format is `c1:c2` | "" | | ||
|
|
||
| As mentioned above the `--config` flag is deprecated and we encourage you to use the `--path` flag instead. For example | ||
| the following command: | ||
|
|
||
| ```shell | ||
| 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>' | ||
| ``` | ||
|
|
||
| may be replaced by: | ||
|
|
||
| ```shell | ||
| 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>' | ||
|
Comment on lines
+169
to
+179
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👏 praise: This is great to have an example here. |
||
| ``` | ||
|
|
||
| ## How to lint a configuration file | ||
|
|
||
| ```shell | ||
| go-feature-flag-cli lint <location_of_your_flag_configuration_file> --format="<yaml or json or toml>" | ||
| ``` | ||
|
|
||
| # License | ||
|
|
||
| View [license](https://github.com/thomaspoignant/go-feature-flag/blob/main/LICENSE) information for the software contained in this image. | ||
| View [license](https://github.com/thomaspoignant/go-feature-flag/blob/main/LICENSE) information for the software | ||
| contained in this image. | ||
|
|
||
| ## How can I contribute? | ||
| 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. | ||
|
|
||
| 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. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have a default value to file to be similar to the old behavior as much as possible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think I understand what u mean. I set default value of
kindto befile, so we're backward compatible (there is a test for that)