Skip to content

Commit 4c34708

Browse files
Update README + fix some markdown issues (#272)
* fix HTML issues Signed-off-by: Thomas Poignant <[email protected]> * fix some issues Signed-off-by: Thomas Poignant <[email protected]> * Fix <br/> Signed-off-by: Thomas Poignant <[email protected]> * Edit readme Signed-off-by: Thomas Poignant <[email protected]>
1 parent ee6045a commit 4c34708

23 files changed

+419
-380
lines changed

Diff for: CONTRIBUTING.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ When contributing to this repository, please first discuss the change you wish t
44
Please note we have a [code of conduct](CODE_OF_CONDUCT.md), please follow it in all your interactions with the project.
55

66
# Pull Request Process
7+
78
1. Ensure any install or build dependencies are removed before the end of the layer when doing a build.
89
2. Please mention the issue in your PR description.
910
3. Expect to be taken seriously, if there are some feedbacks, feel free to discuss about it, your opinion can be better than mine.
1011

1112
# Coding standards
13+
1214
A library is easier to use, and easier for contributors to work on if it has a consistent, unified style, approach, and layout.
1315

1416
We are using [pre-commit](https://pre-commit.com/) to lint before each commit, I would recommend you to use it.
@@ -17,16 +19,19 @@ pre-commit install
1719
```
1820

1921
## Tests
22+
2023
Every feature or bug should come with an associate test to keep the coverage as high as possible.
2124

2225
## Documentation
26+
2327
We are maintaining 2 documentations:
2428
- [README.md](README.md) which contains everything you need to know to start working with the module.
2529
- [go-feature-flag website](https://thomaspoignant.github.io/go-feature-flag/) which is the full detail documentation of the module.
2630

2731
If your contribution has impact on the documentation, please check both version.
2832

2933
### How to run the documentation website locally
34+
3035
For the documentation website we are using [mkdocs](https://www.mkdocs.org/) with the "[Material for MkDocs](https://squidfunk.github.io/mkdocs-material/)" theme.
3136
To run it locally just use the docker image:
3237
```shell
@@ -35,11 +40,14 @@ docker run --rm -it -p 8000:8000 -v ${PWD}:/docs squidfunk/mkdocs-material
3540
The website will be available on http://localhost:8000/
3641

3742
## Sonar
43+
3844
Sonarcloud is used in the project, it will comment your PR to give you feedback on your code.
3945

40-
# Continuous integration
46+
### Continuous integration
47+
4148
We have a list of steps on each PR.
4249
The CI is running:
50+
4351
- Tests
4452
- Coverage
4553
- Code quality

Diff for: README.md

+18-29
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<img src="https://img.shields.io/github/go-mod/go-version/thomaspoignant/go-feature-flag?logo=go%20version" alt="Go version"/>
2222
<a href="LICENSE"><img src="https://img.shields.io/github/license/thomaspoignant/go-feature-flag" alt="License"/></a>
2323
<a href="https://github.com/avelino/awesome-go/#server-applications"><img src="https://awesome.re/mentioned-badge-flat.svg" alt="Mentioned in Awesome Go"></a>
24-
<a href="http://gophers.slack.com/messages/go-feature-flag"><img src="https://img.shields.io/badge/join-us%20on%20slack-gray.svg?longCache=true&logo=slack&colorB=green" alt="Join us on slack"></a>
24+
<a href="http://gophers.slack.com/messages/go-feature-flag"><img src="https://img.shields.io/badge/join-us%20on%20slack-gray.svg?longCache=true&logo=slack&colorB=green" alt="Join us on slack"></a>
2525
</p>
2626

2727
**Feature flags with no complex system to maintain!**
@@ -38,7 +38,7 @@ No server is needed, just add a file to your central system and all your service
3838

3939
**go-feature-flags supports:**
4040

41-
- Storing your configuration flags file on various locations (`HTTP`, `S3`, `GitHub`, `file`, `Google Cloud Storage` ...).
41+
- Storing your configuration flags file on various locations (`HTTP`, `S3`, `GitHub`, `file`, `Google Cloud Storage`, `Kubernetes` ...).
4242
- Configuring your flags in various format (`JSON`, `TOML` and `YAML`).
4343
- Adding complex rules to target your users.
4444
- Use complex rollout strategy for your flags :
@@ -58,6 +58,15 @@ https://user-images.githubusercontent.com/17908063/168597893-e957e648-b795-4b5f-
5858

5959
_The code of this demo is available in [`thomaspoignant/go-feature-flag-demo`](https://github.com/thomaspoignant/go-feature-flag-demo) repository_.
6060

61+
## Can I use GO Feature Flag with another language?
62+
63+
Originally GO Feature Flag was build to be a GOlang only libraries, but it limits too much the echo system.
64+
To be compatible with more language we have implemented the [GO Feature Flag Relay Proxy](https://github.com/thomaspoignant/go-feature-flag-relay-proxy).
65+
It is a service you can host that provides an API to evaluate your flags, you can call it using HTTP to get your variation.
66+
67+
Since we believe in standardization we are also implementing [Open-feature](https://github.com/open-feature) providers to interact with this API in the language of your choice.
68+
__(Open-feature is still at an early stage, so not all language are supported and expect some changes in the future)__
69+
6170
## Getting started
6271
First, you need to initialize the `ffclient` with the location of your backend file.
6372
```go
@@ -123,20 +132,10 @@ ffclient.Init(ffclient.Config{
123132
```
124133
### Configuration fields
125134

126-
| Field | Description |
127-
|---------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
128-
| `Retriever` | The configuration retriever you want to use to get your flag file.<br> *See [Store your flag file](https://thomaspoignant.github.io/go-feature-flag/latest/flag_file/) for the configuration details*. |
129-
| `Context` | *(optional)*<br>The context used by the retriever.<br />Default: `context.Background()` |
130-
| `Environment` | *(optional)*<br>The environment the app is running under, can be checked in feature flag rules.<br />Default: `""` |
131-
| `DataExporter` | *(optional)*<br>DataExporter defines how to export data on how your flags are used.<br> *see [export data section](https://thomaspoignant.github.io/go-feature-flag/latest/data_collection/) for more details*. |
132-
| `FileFormat` | *(optional)*<br>Format of your configuration file. Available formats are `yaml`, `toml` and `json`, if you omit the field it will try to unmarshal the file as a `yaml` file.<br>Default: `YAML` |
133-
| `Logger` | *(optional)*<br>Logger used to log what `go-feature-flag` is doing.<br />If no logger is provided the module will not log anything.<br>Default: No log |
134-
| `Notifiers` | *(optional)*<br>List of notifiers to call when your flag file has been changed.<br> *See [notifiers section](https://thomaspoignant.github.io/go-feature-flag/latest/notifier/) for more details*. |
135-
| `PollingInterval` | *(optional)* Duration to wait before refreshing the flags.<br>The minimum polling interval is 1 second.<br>Default: 60 * time.Second |
136-
| `StartWithRetrieverError` | *(optional)*<br>If **true**, the SDK will start even if we did not get any flags from the retriever. It will serve only default values until the retriever returns the flags.<br>The init method will not return any error if the flag file is unreachable.<br>Default: **false** |
137-
| `Offline` | *(optional)* If **true**, the SDK will not try to retrieve the flag file and will not export any data. No notification will be send neither.<br>Default: false |
135+
All the configuration fields are described in the [configuration documentation page](https://docs.gofeatureflag.org/configuration/).
138136

139137
### Multiple configuration flag files
138+
140139
`go-feature-flag` comes ready to use out of the box by calling the `Init` function and it will be available everywhere.
141140
Since most applications will want to use a single central flag configuration, the package provides this. It is similar to a singleton.
142141

@@ -159,7 +158,7 @@ Available retriever are:
159158
You can also [create your own retriever](https://thomaspoignant.github.io/go-feature-flag/latest/flag_file/custom/).
160159

161160
## Flags file format
162-
`go-feature-flag` core feature is to centralize all your feature flags in a source file, and to avoid hosting and maintaining a backend server to manage them.
161+
`go-feature-flag` core feature is to centralize all your feature flags in a single file, and to avoid hosting and maintaining a backend server to manage them.
163162

164163
Your file should be a `YAML`, `JSON` or `TOML` file with a list of flags *(examples: [`YAML`](testdata/flag-config.yaml), [`JSON`](testdata/flag-config.json), [`TOML`](testdata/flag-config.toml))*.
165164

@@ -260,21 +259,10 @@ version = 12.0
260259

261260
</details>
262261

263-
264-
| Field | Description |
265-
|:-------------:|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
266-
| **flag-key** | Name of your flag.<br> It must be unique.<br>*On the example the flag keys are **`test-flag`** and **`test-flag2`**.* |
267-
| `true` | Value returned by the flag if the rule is evaluated to true and the user is in the active percentage. |
268-
| `false` | Value returned by the flag if the rule is evaluated to true and the user is **not** in the active percentage. |
269-
| `default` | Value returned by the flag if the rule is evaluated to false. |
270-
| `percentage` | *(optional)*<br>Percentage of users who should be affected by the flag.<br>**Default: 0**<br><br>The percentage is computed by calculating a hash of the user key *(100000 variations)*, it means that you can have 3 numbers after the comma. |
271-
| `rule` | *(optional)*<br>Condition to determine on which user the flag should be applied.<br>Rule format is described in the <a href="#rule-format">rule format section</a>.<br>**If no rule is set, the flag applies to all users *(percentage still apply)*.** |
272-
| `disable` | *(optional)*<br>True if the flag is disabled.<br>**Default: `false`** |
273-
| `trackEvents` | *(optional)*<br>False if you don't want to export the data in your data exporter.<br>**Default: `true`** |
274-
| `version` | *(optional)*<br>The version is the version of your flag.<br>This number is used to display the information in the notifiers and data collection, you have to update it your self.<br>**Default: 0** |
275-
| `rollout` | *(optional)*<br><code>rollout</code> contains a specific rollout strategy you want to use.<br>**See [rollout section](https://thomaspoignant.github.io/go-feature-flag/latest/rollout/) for more details.** |
262+
All the fields to create a flag are described in the [documentation](https://docs.gofeatureflag.org/v0.27.1/flag_format/).
276263

277264
## Rule format
265+
278266
The rule format is based on the [`nikunjy/rules`](https://github.com/nikunjy/rules) library.
279267

280268
All the operations can be written capitalized or lowercase (ex: `eq` or `EQ` can be used).
@@ -332,7 +320,8 @@ You can also distinguish logged-in users from anonymous users in the SDK ([check
332320
## Variation
333321
The Variation methods determine whether a flag is enabled or not for a specific user.
334322
There is a Variation method for each type:
335-
[`BoolVariation`](https://pkg.go.dev/github.com/thomaspoignant/go-feature-flag#BoolVariation) , [`IntVariation`](https://pkg.go.dev/github.com/thomaspoignant/go-feature-flag#IntVariation)
323+
[`BoolVariation`](https://pkg.go.dev/github.com/thomaspoignant/go-feature-flag#BoolVariation)
324+
, [`IntVariation`](https://pkg.go.dev/github.com/thomaspoignant/go-feature-flag#IntVariation)
336325
, [`Float64Variation`](https://pkg.go.dev/github.com/thomaspoignant/go-feature-flag#Float64Variation)
337326
, [`StringVariation`](https://pkg.go.dev/github.com/thomaspoignant/go-feature-flag#StringVariation)
338327
, [`JSONArrayVariation`](https://pkg.go.dev/github.com/thomaspoignant/go-feature-flag#JSONArrayVariation)

Diff for: SECURITY.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Security Policy
22

33
## Reporting a Vulnerability
4+
45
If you find a vulnerability please open an issue *(bug report)* with the flag `security` and affect the issue to `thomaspoignant`.
56
I will look into it as soon as possible and will give you more information in the issue as soon I have somne.
67

Diff for: docs/configuration.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ During the initialization you must give a [`ffclient.Config{}`](https://pkg.go.d
88

99
| Field | Description |
1010
|---|---|
11-
|`Retriever` | The configuration retriever you want to use to get your flag file<br> *See [Store your flag file](flag_file/index.md) for the configuration details*.|
12-
|`Context` | *(optional)*<br>The context used by the retriever.<br />Default: `context.Background()`|
13-
|`Environment` | <a name="option_environment"></a>*(optional)*<br>The environment the app is running under, can be checked in feature flag rules.<br />Default: `""`<br>*Check [**"environments"** section](../flag_format/#environments) to understand how to use this parameter.*|
14-
|`DataExporter` | *(optional)*<br>DataExporter defines how to export data on how your flags are used.<br> *see [export data section](data_collection/index.md) for more details*.|
15-
|`FileFormat`| *(optional)*<br>Format of your configuration file. Available formats are `yaml`, `toml` and `json`, if you omit the field it will try to unmarshal the file as a `yaml` file.<br>Default: `YAML`|
16-
|`Logger` | *(optional)*<br>Logger used to log what `go-feature-flag` is doing.<br />If no logger is provided the module will not log anything.<br>Default: No log|
17-
|`Notifiers` | *(optional)*<br>List of notifiers to call when your flag file has been changed.<br> *See [notifiers section](./notifier/index.md) for more details*.|
18-
|`PollingInterval` | (optional) Duration to wait before refreshing the flags.<br>The minimum polling interval is 1 second.<br>Default: 60 * time.Second|
19-
|`StartWithRetrieverError` | *(optional)* If **true**, the SDK will start even if we did not get any flags from the retriever. It will serve only default values until the retriever returns the flags.<br>The init method will not return any error if the flag file is unreachable.<br>Default: **false**|
20-
|`Offline`| *(optional)* If **true**, the SDK will not try to retrieve the flag file and will not export any data. No notification will be send neither.<br>Default: false|
11+
|`Retriever` | The configuration retriever you want to use to get your flag file<br/> *See [Store your flag file](flag_file/index.md) for the configuration details*.|
12+
|`Context` | *(optional)*<br/>The context used by the retriever.<br />Default: `context.Background()`|
13+
|`Environment` | <a name="option_environment"></a>*(optional)*<br/>The environment the app is running under, can be checked in feature flag rules.<br />Default: `""`<br/>*Check [**"environments"** section](../flag_format/#environments) to understand how to use this parameter.*|
14+
|`DataExporter` | *(optional)*<br/>DataExporter defines how to export data on how your flags are used.<br/> *see [export data section](data_collection/index.md) for more details*.|
15+
|`FileFormat`| *(optional)*<br/>Format of your configuration file. Available formats are `yaml`, `toml` and `json`, if you omit the field it will try to unmarshal the file as a `yaml` file.<br/>Default: `YAML`|
16+
|`Logger` | *(optional)*<br/>Logger used to log what `go-feature-flag` is doing.<br />If no logger is provided the module will not log anything.<br/>Default: No log|
17+
|`Notifiers` | *(optional)*<br/>List of notifiers to call when your flag file has been changed.<br/> *See [notifiers section](./notifier/index.md) for more details*.|
18+
|`PollingInterval` | (optional) Duration to wait before refreshing the flags.<br/>The minimum polling interval is 1 second.<br/>Default: 60 * time.Second|
19+
|`StartWithRetrieverError` | *(optional)* If **true**, the SDK will start even if we did not get any flags from the retriever. It will serve only default values until the retriever returns the flags.<br/>The init method will not return any error if the flag file is unreachable.<br/>Default: **false**|
20+
|`Offline`| *(optional)* If **true**, the SDK will not try to retrieve the flag file and will not export any data. No notification will be send neither.<br/>Default: false|
2121

2222
## Example
2323
```go linenums="1"

0 commit comments

Comments
 (0)