Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSami Hiltunen <shiltunen@gitlab.com>2021-01-19 19:37:06 +0300
committerSami Hiltunen <shiltunen@gitlab.com>2021-01-19 19:37:06 +0300
commit99f78e4d93d8c9ec23ef710ffde0fb4b75d786bb (patch)
tree13a6e528f8a338e899cd64de6781734db99c7455
parent6a06feda7fd01961bb332afce4d7f7b4ce4a5aad (diff)
parent5aae918d54bddb19743d0f2aae54948ecedac273 (diff)
Merge branch 'pks-feature-flags-enable-all-via-env' into 'master'
featureflag: Support environment variable to enable all feature flags See merge request gitlab-org/gitaly!3020
-rw-r--r--internal/metadata/featureflag/grpc_header.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/metadata/featureflag/grpc_header.go b/internal/metadata/featureflag/grpc_header.go
index 23e144d86..1f114a2f4 100644
--- a/internal/metadata/featureflag/grpc_header.go
+++ b/internal/metadata/featureflag/grpc_header.go
@@ -3,6 +3,7 @@ package featureflag
import (
"context"
"fmt"
+ "os"
"strconv"
"strings"
@@ -11,6 +12,13 @@ import (
)
var (
+ // featureFlagsOverride allows to enable all feature flags with a
+ // single environment variable. If the value of
+ // GITALY_TESTING_ENABLE_ALL_FEATURE_FLAGS is set to "true", then all
+ // feature flags will be enabled. This is only used for testing
+ // purposes such that we can run integration tests with feature flags.
+ featureFlagsOverride = os.Getenv("GITALY_TESTING_ENABLE_ALL_FEATURE_FLAGS")
+
flagChecks = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "gitaly_feature_flag_checks_total",
@@ -27,6 +35,10 @@ func init() {
// IsEnabled checks if the feature flag is enabled for the passed context.
// Only returns true if the metadata for the feature flag is set to "true"
func IsEnabled(ctx context.Context, flag FeatureFlag) bool {
+ if featureFlagsOverride == "true" {
+ return true
+ }
+
val, ok := getFlagVal(ctx, flag.Name)
if !ok {
return flag.OnByDefault