You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+9-1
Original file line number
Diff line number
Diff line change
@@ -4,11 +4,13 @@ When contributing to this repository, please first discuss the change you wish t
4
4
Please note we have a [code of conduct](CODE_OF_CONDUCT.md), please follow it in all your interactions with the project.
5
5
6
6
# Pull Request Process
7
+
7
8
1. Ensure any install or build dependencies are removed before the end of the layer when doing a build.
8
9
2. Please mention the issue in your PR description.
9
10
3. Expect to be taken seriously, if there are some feedbacks, feel free to discuss about it, your opinion can be better than mine.
10
11
11
12
# Coding standards
13
+
12
14
A library is easier to use, and easier for contributors to work on if it has a consistent, unified style, approach, and layout.
13
15
14
16
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
17
19
```
18
20
19
21
## Tests
22
+
20
23
Every feature or bug should come with an associate test to keep the coverage as high as possible.
21
24
22
25
## Documentation
26
+
23
27
We are maintaining 2 documentations:
24
28
-[README.md](README.md) which contains everything you need to know to start working with the module.
25
29
-[go-feature-flag website](https://thomaspoignant.github.io/go-feature-flag/) which is the full detail documentation of the module.
26
30
27
31
If your contribution has impact on the documentation, please check both version.
28
32
29
33
### How to run the documentation website locally
34
+
30
35
For the documentation website we are using [mkdocs](https://www.mkdocs.org/) with the "[Material for MkDocs](https://squidfunk.github.io/mkdocs-material/)" theme.
<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>
25
25
</p>
26
26
27
27
**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
38
38
39
39
**go-feature-flags supports:**
40
40
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` ...).
42
42
- Configuring your flags in various format (`JSON`, `TOML` and `YAML`).
_The code of this demo is available in [`thomaspoignant/go-feature-flag-demo`](https://github.com/thomaspoignant/go-feature-flag-demo) repository_.
60
60
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
+
61
70
## Getting started
62
71
First, you need to initialize the `ffclient` with the location of your backend file.
|`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/).
138
136
139
137
### Multiple configuration flag files
138
+
140
139
`go-feature-flag` comes ready to use out of the box by calling the `Init` function and it will be available everywhere.
141
140
Since most applications will want to use a single central flag configuration, the package provides this. It is similar to a singleton.
142
141
@@ -159,7 +158,7 @@ Available retriever are:
159
158
You can also [create your own retriever](https://thomaspoignant.github.io/go-feature-flag/latest/flag_file/custom/).
160
159
161
160
## 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.
163
162
164
163
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))*.
|**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 <ahref="#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/).
276
263
277
264
## Rule format
265
+
278
266
The rule format is based on the [`nikunjy/rules`](https://github.com/nikunjy/rules) library.
279
267
280
268
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
332
320
## Variation
333
321
The Variation methods determine whether a flag is enabled or not for a specific user.
Copy file name to clipboardExpand all lines: docs/configuration.md
+10-10
Original file line number
Diff line number
Diff line change
@@ -8,16 +8,16 @@ During the initialization you must give a [`ffclient.Config{}`](https://pkg.go.d
8
8
9
9
| Field | Description |
10
10
|---|---|
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`| <aname="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`| <aname="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|
0 commit comments