From 5f610613064afefb38f534490fd30f352fbaf0a7 Mon Sep 17 00:00:00 2001 From: Sattvik Chakravarthy Date: Mon, 15 Jul 2024 10:28:30 +0530 Subject: [PATCH] fix: HideFromDashboard annotation (#1014) * fix: HideFromDashboard annotation * fix: comment --- .../io/supertokens/config/CoreConfig.java | 5 ++++ .../config/annotations/HideFromDashboard.java | 27 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 src/main/java/io/supertokens/config/annotations/HideFromDashboard.java diff --git a/src/main/java/io/supertokens/config/CoreConfig.java b/src/main/java/io/supertokens/config/CoreConfig.java index 1157db469..5f9f057af 100644 --- a/src/main/java/io/supertokens/config/CoreConfig.java +++ b/src/main/java/io/supertokens/config/CoreConfig.java @@ -56,6 +56,7 @@ public class CoreConfig { // @IgnoreForAnnotationCheck: Set this if the property is neither @ConfigYamlOnly nor @NotConflictingInApp, or should // simply be ignored by the test (if the property is just an internal member and not an exposed config) that checks // for annotations on all properties. + // @HideFromDashboard: The property should not be shown in the dashboard @IgnoreForAnnotationCheck public static final String[] PROTECTED_CONFIGS = new String[]{ @@ -174,6 +175,7 @@ public class CoreConfig { @NotConflictingInApp @JsonProperty + @HideFromDashboard @ConfigDescription( "The API keys to query an instance using this config file. The format is \"key1,key2,key3\". Keys can " + "only contain '=', '-' and alpha-numeric (including capital) chars. Each key must have a minimum " + @@ -273,6 +275,7 @@ public class CoreConfig { @ConfigYamlOnly @JsonProperty + @HideFromDashboard @ConfigDescription( "This is used when deploying the core in SuperTokens SaaS infrastructure. If set, limits what database " + "information is shown to / modifiable by the dev when they query the core to get the information " + @@ -282,6 +285,7 @@ public class CoreConfig { @NotConflictingInApp @JsonProperty + @HideFromDashboard @ConfigDescription( "This is used when the core needs to assume a specific CDI version when CDI version is not specified in " + "the request. When set to null, the core will assume the latest version of the CDI. (Default: " + @@ -857,6 +861,7 @@ public static ArrayList getConfigFieldsInfoForDashboard(Main ma // or is annotated with ConfigYamlOnly, then skip if (!field.isAnnotationPresent(JsonProperty.class) || field.isAnnotationPresent(ConfigYamlOnly.class) + || field.isAnnotationPresent(HideFromDashboard.class) || fieldId.equals("core_config_version")) { continue; } diff --git a/src/main/java/io/supertokens/config/annotations/HideFromDashboard.java b/src/main/java/io/supertokens/config/annotations/HideFromDashboard.java new file mode 100644 index 000000000..e2f8c0e68 --- /dev/null +++ b/src/main/java/io/supertokens/config/annotations/HideFromDashboard.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2023, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +package io.supertokens.config.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface HideFromDashboard { +}