Commit 9bcee792 authored by Emiliano Balbuena's avatar Emiliano Balbuena

(feat): Unleash / CLI script

1 merge request!39New Feature Flags docs
......@@ -61,7 +61,15 @@ $CONFIG->set('features', [
#### Unleash server
> TK
This is used to switch features on production-like environments. Values are applied after the sync CLI script fetches them from the server. Server URL, Instance ID and Application Name can be set on `$CONFIG->set('unleash', ...)` entry in `settings.php`.
Flags can be switched on and off per-environment at https://gitlab.com/minds/infrastructure/feature-flags/-/feature_flags/.
All GitLab strategies are available. Groups can be referenced using the percent character on the User ID strategy and there can be multiple targets (example: `100000000123, 1000000000999, %canary, %pro`).
*Environment Spec* is matched with the provided `applicationName` value in `settings.php`, fallbacking to `*`.
> Important: If the **BIG** Status switch on GitLab's Feature Flags main page is set to OFF, the feature flag becomes invisible and it's NOT returned by the Unleash server when synchronizing. This makes the fallback to be: `False → $CONFIG → EnvVar`.
#### Environment variables
......@@ -100,6 +108,17 @@ if ($this->features->has('my-cool-feature')) {
}
```
### Sync CLI
#### Development
On PHP-FPM container, run:
```sh
php cli.php features sync --environment=development,sandbox --ttl=120 --forever
```
The above command would synchronize `development` and `sandbox` environment specs every 2 minutes.
### Frontend
#### Component code
......@@ -181,3 +200,9 @@ $CONFIG->set('min_log_level', 100);
- `plus`: Users with an active Plus (or Pro) subscription
- `pro`: Users with an active Pro subscription
- `admin`: Site admins
### Potential issues
#### Help! My GitLab flags are not being sync-ed.
Ensure the sync CLI is running and synchronizing.
\ No newline at end of file
Please register or to comment