Skip to content

Commit d1e1e28

Browse files
authored
Merge pull request #174 from authorizerdev/fix/memory-store
fix: replica cache consistency
2 parents 7b13034 + a7f04f8 commit d1e1e28

File tree

131 files changed

+3023
-1863
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+3023
-1863
lines changed

.env.sample

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
ENV=production
12
DATABASE_URL=data.db
23
DATABASE_TYPE=sqlite
34
CUSTOM_ACCESS_TOKEN_SCRIPT="function(user,tokenPayload){var data = tokenPayload;data.extra = {'x-extra-id': user.id};return data;}"

.env.test

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
ENV=test
2+
DATABASE_URL=test.db
3+
DATABASE_TYPE=sqlite
4+
CUSTOM_ACCESS_TOKEN_SCRIPT="function(user,tokenPayload){var data = tokenPayload;data.extra = {'x-extra-id': user.id};return data;}"
5+
SMTP_HOST=smtp.mailtrap.io
6+
SMTP_PORT=2525
7+
SMTP_USERNAME=test
8+
SMTP_PASSWORD=test
9+
SENDER_EMAIL="[email protected]"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ dashboard/build
88
build
99
.env
1010
data.db
11+
test.db
1112
.DS_Store
1213
.env.local
1314
*.tar.gz

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ build-dashboard:
1010
clean:
1111
rm -rf build
1212
test:
13-
cd server && go clean --testcache && go test -v ./test
13+
rm -rf server/test/test.db && rm -rf test.db && cd server && go clean --testcache && go test -p 1 -v ./test
1414
generate:
1515
cd server && go get github.com/99designs/gqlgen/[email protected] && go run github.com/99designs/gqlgen generate
1616

Lines changed: 84 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,89 @@
1-
import React from "react";
2-
import { Flex, Stack, Center, Text, useMediaQuery } from "@chakra-ui/react";
1+
import React from 'react';
2+
import { Flex, Stack, Center, Text, useMediaQuery } from '@chakra-ui/react';
33

4-
import InputField from "../../components/InputField";
5-
import { TextInputType } from "../../constants";
4+
import InputField from '../../components/InputField';
5+
import { TextInputType } from '../../constants';
66

77
const DatabaseCredentials = ({ variables, setVariables }: any) => {
8-
const [isNotSmallerScreen] = useMediaQuery("(min-width:600px)");
9-
return (
10-
<div>
11-
{" "}
12-
<Text fontSize="md" paddingTop="2%" fontWeight="bold">
13-
Database Credentials
14-
</Text>
15-
<Stack spacing={6} padding="3% 0">
16-
<Text fontStyle="italic" fontSize="sm" color="blackAlpha.500" mt={3}>
17-
Note: Database related environment variables cannot be updated from
18-
dashboard :(
19-
</Text>
20-
<Flex direction={isNotSmallerScreen ? "row" : "column"}>
21-
<Flex
22-
w={isNotSmallerScreen ? "30%" : "40%"}
23-
justifyContent="start"
24-
alignItems="center"
25-
>
26-
<Text fontSize="sm">DataBase Name:</Text>
27-
</Flex>
28-
<Center
29-
w={isNotSmallerScreen ? "70%" : "100%"}
30-
mt={isNotSmallerScreen ? "0" : "3"}
31-
>
32-
<InputField
33-
borderRadius={5}
34-
variables={variables}
35-
setVariables={setVariables}
36-
inputType={TextInputType.DATABASE_NAME}
37-
isDisabled={true}
38-
/>
39-
</Center>
40-
</Flex>
41-
<Flex direction={isNotSmallerScreen ? "row" : "column"}>
42-
<Flex
43-
w={isNotSmallerScreen ? "30%" : "40%"}
44-
justifyContent="start"
45-
alignItems="center"
46-
>
47-
<Text fontSize="sm">DataBase Type:</Text>
48-
</Flex>
49-
<Center
50-
w={isNotSmallerScreen ? "70%" : "100%"}
51-
mt={isNotSmallerScreen ? "0" : "3"}
52-
>
53-
<InputField
54-
borderRadius={5}
55-
variables={variables}
56-
setVariables={setVariables}
57-
inputType={TextInputType.DATABASE_TYPE}
58-
isDisabled={true}
59-
/>
60-
</Center>
61-
</Flex>
62-
<Flex direction={isNotSmallerScreen ? "row" : "column"}>
63-
<Flex
64-
w={isNotSmallerScreen ? "30%" : "40%"}
65-
justifyContent="start"
66-
alignItems="center"
67-
>
68-
<Text fontSize="sm">DataBase URL:</Text>
69-
</Flex>
70-
<Center
71-
w={isNotSmallerScreen ? "70%" : "100%"}
72-
mt={isNotSmallerScreen ? "0" : "3"}
73-
>
74-
<InputField
75-
borderRadius={5}
76-
variables={variables}
77-
setVariables={setVariables}
78-
inputType={TextInputType.DATABASE_URL}
79-
isDisabled={true}
80-
/>
81-
</Center>
82-
</Flex>
83-
</Stack>
84-
</div>
85-
);
8+
const [isNotSmallerScreen] = useMediaQuery('(min-width:600px)');
9+
return (
10+
<div>
11+
{' '}
12+
<Text fontSize="md" paddingTop="2%" fontWeight="bold">
13+
Database Credentials
14+
</Text>
15+
<Stack spacing={6} padding="3% 0">
16+
<Text fontStyle="italic" fontSize="sm" color="blackAlpha.500" mt={3}>
17+
Note: Database related environment variables cannot be updated from
18+
dashboard. Please use .env file or OS environment variables to update
19+
it.
20+
</Text>
21+
<Flex direction={isNotSmallerScreen ? 'row' : 'column'}>
22+
<Flex
23+
w={isNotSmallerScreen ? '30%' : '40%'}
24+
justifyContent="start"
25+
alignItems="center"
26+
>
27+
<Text fontSize="sm">DataBase Name:</Text>
28+
</Flex>
29+
<Center
30+
w={isNotSmallerScreen ? '70%' : '100%'}
31+
mt={isNotSmallerScreen ? '0' : '3'}
32+
>
33+
<InputField
34+
borderRadius={5}
35+
variables={variables}
36+
setVariables={setVariables}
37+
inputType={TextInputType.DATABASE_NAME}
38+
isDisabled={true}
39+
/>
40+
</Center>
41+
</Flex>
42+
<Flex direction={isNotSmallerScreen ? 'row' : 'column'}>
43+
<Flex
44+
w={isNotSmallerScreen ? '30%' : '40%'}
45+
justifyContent="start"
46+
alignItems="center"
47+
>
48+
<Text fontSize="sm">DataBase Type:</Text>
49+
</Flex>
50+
<Center
51+
w={isNotSmallerScreen ? '70%' : '100%'}
52+
mt={isNotSmallerScreen ? '0' : '3'}
53+
>
54+
<InputField
55+
borderRadius={5}
56+
variables={variables}
57+
setVariables={setVariables}
58+
inputType={TextInputType.DATABASE_TYPE}
59+
isDisabled={true}
60+
/>
61+
</Center>
62+
</Flex>
63+
<Flex direction={isNotSmallerScreen ? 'row' : 'column'}>
64+
<Flex
65+
w={isNotSmallerScreen ? '30%' : '40%'}
66+
justifyContent="start"
67+
alignItems="center"
68+
>
69+
<Text fontSize="sm">DataBase URL:</Text>
70+
</Flex>
71+
<Center
72+
w={isNotSmallerScreen ? '70%' : '100%'}
73+
mt={isNotSmallerScreen ? '0' : '3'}
74+
>
75+
<InputField
76+
borderRadius={5}
77+
variables={variables}
78+
setVariables={setVariables}
79+
inputType={TextInputType.DATABASE_URL}
80+
isDisabled={true}
81+
/>
82+
</Center>
83+
</Flex>
84+
</Stack>
85+
</div>
86+
);
8687
};
8788

88-
export default DatabaseCredentials;
89+
export default DatabaseCredentials;

dashboard/src/components/EnvComponents/UICustomization.tsx renamed to dashboard/src/components/EnvComponents/Features.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Flex, Stack, Text } from '@chakra-ui/react';
33
import InputField from '../InputField';
44
import { SwitchInputType } from '../../constants';
55

6-
const UICustomization = ({ variables, setVariables }: any) => {
6+
const Features = ({ variables, setVariables }: any) => {
77
return (
88
<div>
99
{' '}
@@ -76,4 +76,4 @@ const UICustomization = ({ variables, setVariables }: any) => {
7676
);
7777
};
7878

79-
export default UICustomization;
79+
export default Features;
Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,42 @@
1-
import React from "react";
2-
import { Flex, Stack, Center, Text, useMediaQuery } from "@chakra-ui/react";
3-
import InputField from "../InputField";
1+
import React from 'react';
2+
import { Flex, Stack, Center, Text, useMediaQuery } from '@chakra-ui/react';
3+
import InputField from '../InputField';
44

55
const SessionStorage = ({ variables, setVariables, RedisURL }: any) => {
6-
const [isNotSmallerScreen] = useMediaQuery("(min-width:600px)");
7-
return (
8-
<div>
9-
{" "}
10-
<Text fontSize="md" paddingTop="2%" fontWeight="bold" mb={5}>
11-
Session Storage
12-
</Text>
13-
<Stack spacing={6} padding="2% 0%">
14-
<Flex direction={isNotSmallerScreen ? "row" : "column"}>
15-
<Flex w="30%" justifyContent="start" alignItems="center">
16-
<Text fontSize="sm">Redis URL:</Text>
17-
</Flex>
18-
<Center
19-
w={isNotSmallerScreen ? "70%" : "100%"}
20-
mt={isNotSmallerScreen ? "0" : "3"}
21-
>
22-
<InputField
23-
borderRadius={5}
24-
variables={variables}
25-
setVariables={setVariables}
26-
inputType={RedisURL}
27-
placeholder="Redis URL"
28-
/>
29-
</Center>
30-
</Flex>
31-
</Stack>
32-
</div>
33-
);
6+
const [isNotSmallerScreen] = useMediaQuery('(min-width:600px)');
7+
return (
8+
<div>
9+
{' '}
10+
<Text fontSize="md" paddingTop="2%" fontWeight="bold" mb={5}>
11+
Session Storage
12+
</Text>
13+
<Text fontStyle="italic" fontSize="sm" color="blackAlpha.500" mt={3}>
14+
Note: Redis related environment variables cannot be updated from
15+
dashboard. Please use .env file or OS environment variables to update
16+
it.
17+
</Text>
18+
<Stack spacing={6} padding="2% 0%">
19+
<Flex direction={isNotSmallerScreen ? 'row' : 'column'}>
20+
<Flex w="30%" justifyContent="start" alignItems="center">
21+
<Text fontSize="sm">Redis URL:</Text>
22+
</Flex>
23+
<Center
24+
w={isNotSmallerScreen ? '70%' : '100%'}
25+
mt={isNotSmallerScreen ? '0' : '3'}
26+
>
27+
<InputField
28+
disabled
29+
borderRadius={5}
30+
variables={variables}
31+
setVariables={setVariables}
32+
inputType={RedisURL}
33+
placeholder="Redis URL"
34+
/>
35+
</Center>
36+
</Flex>
37+
</Stack>
38+
</div>
39+
);
3440
};
3541

36-
export default SessionStorage;
42+
export default SessionStorage;

dashboard/src/components/InviteMembersModal.tsx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
InputRightElement,
2323
Text,
2424
Link,
25-
Tooltip
25+
Tooltip,
2626
} from '@chakra-ui/react';
2727
import { useClient } from 'urql';
2828
import { FaUserPlus, FaMinusCircle, FaPlus, FaUpload } from 'react-icons/fa';
@@ -187,22 +187,22 @@ const InviteMembersModal = ({
187187
isDisabled={disabled}
188188
size="sm"
189189
>
190-
<Center h="100%">
191-
{disabled ? (
192-
<Tooltip
193-
mr={8}
194-
mt={1}
195-
hasArrow
196-
bg="gray.300"
197-
color="black"
198-
label="Email verification is disabled, refer to 'UI Customization' tab within 'Environment' to enable it."
199-
>
200-
Invite Members
201-
</Tooltip>
202-
) : (
203-
"Invite Members"
204-
)}
205-
</Center>{" "}
190+
<Center h="100%">
191+
{disabled ? (
192+
<Tooltip
193+
mr={8}
194+
mt={1}
195+
hasArrow
196+
bg="gray.300"
197+
color="black"
198+
label="Email verification is disabled, refer to 'Features' tab within 'Environment' to enable it."
199+
>
200+
Invite Members
201+
</Tooltip>
202+
) : (
203+
'Invite Members'
204+
)}
205+
</Center>{' '}
206206
</Button>
207207
<Modal isOpen={isOpen} onClose={closeModalHandler} size="xl">
208208
<ModalOverlay />

dashboard/src/components/Menu.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ const LinkItems: Array<LinkItemProps> = [
9898
},
9999
{ name: 'Access Token', icon: SiOpenaccess, route: '/access-token' },
100100
{
101-
name: 'UI Customization',
101+
name: 'Features',
102102
icon: BiCustomize,
103-
route: '/ui-customization',
103+
route: '/features',
104104
},
105105
{ name: 'Database', icon: RiDatabase2Line, route: '/db-cred' },
106106
{

dashboard/src/constants.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export const SwitchInputType = {
6262
DISABLE_EMAIL_VERIFICATION: 'DISABLE_EMAIL_VERIFICATION',
6363
DISABLE_BASIC_AUTHENTICATION: 'DISABLE_BASIC_AUTHENTICATION',
6464
DISABLE_SIGN_UP: 'DISABLE_SIGN_UP',
65+
DISABLE_REDIS_FOR_ENV: 'DISABLE_REDIS_FOR_ENV',
6566
};
6667

6768
export const DateInputType = {
@@ -138,7 +139,7 @@ export const envSubViews = {
138139
WHITELIST_VARIABLES: 'whitelist-variables',
139140
ORGANIZATION_INFO: 'organization-info',
140141
ACCESS_TOKEN: 'access-token',
141-
UI_CUSTOMIZATION: 'ui-customization',
142+
FEATURES: 'features',
142143
ADMIN_SECRET: 'admin-secret',
143144
DB_CRED: 'db-cred',
144145
};

0 commit comments

Comments
 (0)