dot
dot

Reputation: 15670

How to disable a feature flag in just one environment?

I feel like I'm missing something obvious here. Maybe I need more coffee today. But I have the following flags set up in my repo:

enter image description here

What's not clear is how to enable / disable a flag per environment. Specifically how do I set the testflag to true in production, but false in development using the Gitlab gui? You can't have duplicate named feature flags so it's not like I can create one for development and another one just for production.

maybe the idea is that I have to change the values programmatically and not via gui? This is the article I'm reading right now: https://docs.gitlab.com/ee/development/feature_flags/#usage-1.

The version I'm using is GitLab Community Edition v16.7.2

EDIT 1

I have read the article here: https://docs.gitlab.com/ee/operations/feature_flags.html#disable-a-feature-flag-for-a-specific-environment

And the way I understand it is that there's no way to "disable" a flag per environment. You basically have to delete it.

For example, in my case, if I edit "testflag" and remove development from the list of flags, when I query the feature flag API, it's the same as deleting it. This is the Json I get back for that specific flag if I remove the environment:

   {
        "name": "testflag",
        "description": "",
        "active": true,
        "version": "new_version_flag",
        "created_at": "2024-01-09T18:34:30.607Z",
        "updated_at": "2024-01-12T16:38:19.026Z",
        "scopes": [],
        "strategies": [
            {
                "id": 13,
                "name": "default",
                "parameters": {},
                "scopes": [
                    {
                        "id": 27,
                        "environment_scope": "production"
                    }
                ],
                "user_list": null
            }
        ]

What I was hoping for is a list of flags that reads something like:

   {
        "name": "testflag",
        "description": "",
        "version": "new_version_flag",
        "created_at": "2024-01-09T18:34:30.607Z",
        "updated_at": "2024-01-12T16:38:19.026Z",
        "scopes": [],
        "strategies": [
            {
                "id": 13,
                "name": "default",
                "parameters": {},
                "scopes": [
                    {
                        "id": 27,
                        "environment_scope": "production"
                         "active": true
                    },
                    {
                        "id": 27,
                        "environment_scope": "development"
                         "active": false
                    }
                ],
                "user_list": null
            }
        ]

Upvotes: 1

Views: 451

Answers (0)

Related Questions