Commit 472fe858 authored by Emiliano Balbuena's avatar Emiliano Balbuena

(chore): Debugging section; clarifications and fixes

1 merge request!39WIP: New Feature Flags docs
......@@ -11,7 +11,19 @@ Start by setting up a feature flag and then wrap a "gate" around code that you w
### Declare a new feature
First, declare the flag in `Features\Keys` array binding at `engine/Core/Features/Provider.php`. This will make it available with a default value of `false`.
First, declare the flag in `Features\Keys` array binding at `engine/Core/Features/Provider.php`. This will automatically make the feature available with a default value of `false`.
```php
$this->di->bind('Features\Keys', function () {
return [
// ...
'my-cool-feature',
// ...
];
});
```
> This is an **IMPORTANT** step because, no matter which service is used later, only the features listed here are going to be available for use.
### Configure
......@@ -57,9 +69,9 @@ This will be useful on environments that will run multiple app containers using
Please note that you normally would need to restart your services in order to PHP read the variables. Usually, the best place to set these variables are on an initialization script or a Helm chart spec.
Since environment variables values are strings, feature flags will have `1` for `true`, and `0` for `false. As $CONFIG, you can also target a feature to a *single* user group by declaring the value containing the group name.
Since environment variables values are strings, feature flags will have `1` for `true`, and `0` for `false`. As $CONFIG, you can also target a feature to a *single* user group by declaring the value containing the group name.
> Important: Variable names should be *uppercase*, have only alphanumeric characters with underscores(`A-Z0-9_`) and prefixed with `MINDS_FEATURE_`. **All non-alphanumeric characters will be replaced with underscores**.
> Important: Variable names should be *uppercase*, have *only alphanumeric characters with underscores* (`A-Z0-9_`) and *prefixed* with `MINDS_FEATURE_`. **All non-alphanumeric characters will be replaced with underscores**.
| Feature | Value | EnvVar declaration |
|---|---|---|
......@@ -145,6 +157,20 @@ import featuresService from '/path/to/common/services/features.service';
</View>
```
## Debugging
### Values
To debug the values and their origin, you can log in with an admin user and go to ≡ Menu > Admin > Features.
### Unleash
To debug Unleash client operations, you can set the Logger verbosity to DEBUG in `settings.php` (noisy!):
```php
$CONFIG->set('min_log_level', 100);
```
## Appendix
### Available groups
......@@ -154,4 +180,4 @@ import featuresService from '/path/to/common/services/features.service';
- `canary`: Users with experiments turned on
- `plus`: Users with an active Plus (or Pro) subscription
- `pro`: Users with an active Pro subscription
- `admin`: Site admins
\ No newline at end of file
- `admin`: Site admins
Please register or to comment