Skip to content

Commit 4bd01d4

Browse files
committed
- Add redis to docker-compose
- Streamline env management and reorganize files - Add [email protected] to keyring
1 parent 4e3d1d5 commit 4bd01d4

File tree

18 files changed

+73
-59
lines changed

18 files changed

+73
-59
lines changed

.env.secret

25 Bytes
Binary file not shown.

.gitsecret/keys/pubring.kbx

-36 Bytes
Binary file not shown.

.gitsecret/keys/pubring.kbx~

0 Bytes
Binary file not shown.

.gitsecret/paths/mapping.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
.env:9c1a52e44745107c32d34055320ee62f4572a83a96453b4d38495940c79ab9a3
1+
.env:1074cf24f051cdd8cbbdf11b4e1c8f2ed88736319a8c0771476e55c77e239a78
22
src/config/private.pem:040731b01f84c8b9119367982872acb3d046cdf67f21566e18cfa337c130c1d4
33
src/config/public.pem:2a545e85b82c860d6185deff6f81a8d478b7d21eba2062dceae84d2cee03211d

docker-compose.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,24 @@ version: '3.4'
22

33
services:
44
database:
5-
image: '${REGISTRY_NAME}mongo:latest'
5+
image: '${REGISTRY_NAME}mongo:4.2-bionic'
66
volumes:
77
- casidb:/data/db
88
networks:
99
- 'internal'
1010
restart: 'unless-stopped'
11+
redis:
12+
image: '${REGISTRY_NAME}redis:6.2-alpine'
13+
restart: always
14+
networks:
15+
- 'internal'
16+
ports:
17+
- '6379:6379'
18+
env_file:
19+
- './.env'
20+
command: redis-server --loglevel warning --requirepass ${REDIS_PASS}
21+
volumes:
22+
- casi_redis:/data
1123
CASI:
1224
build: .
1325
image: '${REGISTRY_NAME}devclubiitd/casi:0.1'
@@ -30,9 +42,11 @@ services:
3042
- MONGODB_URI_LOCAL
3143
depends_on:
3244
- database
45+
- redis
3346

3447
volumes:
3548
casidb:
49+
casi_redis:
3650

3751
networks:
3852
reverseproxy:

src/config/axios.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import * as keys from './keys';
2+
3+
const HttpsProxyAgent = require('https-proxy-agent');
4+
5+
const axiosDefaultConfig = {
6+
proxy: false,
7+
httpsAgent: !keys.isDev
8+
? new HttpsProxyAgent('http://devclub.iitd.ac.in:3128')
9+
: null,
10+
};
11+
const axios = require('axios').create(axiosDefaultConfig);
12+
13+
export default axios;

src/config/keys.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
const fs = require('fs');
22
const path = require('path');
33

4+
require('dotenv').config({
5+
path: `${__dirname}/../../.env`,
6+
});
7+
48
export const expTime = 60 * 20;
59
export const rememberTime = 60 * 60 * 24 * 2;
610
export const reqExpTime = 60;
@@ -19,6 +23,7 @@ export const accountExists =
1923
'An account is already linked with that account, Please try linking another one.';
2024

2125
export const noRedirectState = 'xyz';
26+
export const isDev = process.env.NODE_ENV === 'DEV';
2227

2328
// Role to Privilege
2429
export const r2p = {

src/config/private.pem.secret

-3 Bytes
Binary file not shown.

src/config/public.pem.secret

-3 Bytes
Binary file not shown.

src/config/redis.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import redis from 'redis';
2+
import { isDev } from './keys';
3+
4+
const redisURl = isDev
5+
? 'redis://127.0.0.1:6379'
6+
: `redis://:${process.env.REDIS_PASS}@redis:6379`;
7+
const rtokens = redis.createClient({
8+
url: redisURl,
9+
});
10+
11+
rtokens.on('error', (err) => {
12+
console.log(err);
13+
});
14+
15+
export default rtokens;

0 commit comments

Comments
 (0)