diff --git a/dashboard/src/components/EnvComponents/Roles.tsx b/dashboard/src/components/EnvComponents/Roles.tsx
index ac610ab..dcafff8 100644
--- a/dashboard/src/components/EnvComponents/Roles.tsx
+++ b/dashboard/src/components/EnvComponents/Roles.tsx
@@ -1,67 +1,68 @@
-import React from "react";
-import { Flex, Stack, Center, Text, useMediaQuery } from "@chakra-ui/react";
-import { ArrayInputType } from "../../constants";
-import InputField from "../InputField";
+import React from 'react';
+import { Flex, Stack, Center, Text, useMediaQuery } from '@chakra-ui/react';
+import { ArrayInputType } from '../../constants';
+import InputField from '../InputField';
const Roles = ({ variables, setVariables }: any) => {
- const [isNotSmallerScreen] = useMediaQuery("(min-width:600px)");
- return (
-
- {" "}
-
- Roles
-
-
-
-
- Roles:
-
-
-
-
-
-
-
- Default Roles:
-
-
-
-
-
-
-
- Protected Roles:
-
-
-
-
-
-
-
- );
+ const [isNotSmallerScreen] = useMediaQuery('(min-width:600px)');
+
+ return (
+
+ {' '}
+
+ Roles
+
+
+
+
+ Roles:
+
+
+
+
+
+
+
+ Default Roles:
+
+
+
+
+
+
+
+ Protected Roles:
+
+
+
+
+
+
+
+ );
};
-export default Roles;
\ No newline at end of file
+export default Roles;
diff --git a/dashboard/src/graphql/queries/index.ts b/dashboard/src/graphql/queries/index.ts
index 346c3cb..221ed53 100644
--- a/dashboard/src/graphql/queries/index.ts
+++ b/dashboard/src/graphql/queries/index.ts
@@ -30,6 +30,7 @@ export const EnvVariablesQuery = `
LINKEDIN_CLIENT_SECRET,
DEFAULT_ROLES,
PROTECTED_ROLES,
+ ROLES,
JWT_TYPE,
JWT_SECRET,
JWT_ROLE_CLAIM,
diff --git a/server/resolvers/env.go b/server/resolvers/env.go
index 15c2653..a8b9a95 100644
--- a/server/resolvers/env.go
+++ b/server/resolvers/env.go
@@ -147,7 +147,14 @@ func EnvResolver(ctx context.Context) (*model.Env, error) {
res.AllowedOrigins = strings.Split(store[constants.EnvKeyAllowedOrigins].(string), ",")
res.Roles = strings.Split(store[constants.EnvKeyRoles].(string), ",")
res.DefaultRoles = strings.Split(store[constants.EnvKeyDefaultRoles].(string), ",")
- res.ProtectedRoles = strings.Split(store[constants.EnvKeyProtectedRoles].(string), ",")
+ // since protected role is optional default split gives array with empty string
+ protectedRoles := strings.Split(store[constants.EnvKeyProtectedRoles].(string), ",")
+ res.ProtectedRoles = []string{}
+ for _, role := range protectedRoles {
+ if strings.Trim(role, " ") != "" {
+ res.ProtectedRoles = append(res.ProtectedRoles, strings.Trim(role, " "))
+ }
+ }
// bool vars
res.DisableEmailVerification = store[constants.EnvKeyDisableEmailVerification].(bool)